Archive for October, 2008

how to find a string within a string

Find a String within a String:
Search a String “a Nice” is Exist or Not within a String “Have a Nice Day” in JAVA

Coding:

String s = “Have a Nice Day”;
if(s.indexOf(“a Nice”)!=-1)
System.out.println(“string exist==>”);
else
System.out.println(“string Not exist==>”);

Popularity: 1% [?]

Pagination in JSP

Pagination Using Display Tag :

If you would like to make use of the display taglib in your own application, do the following

1.Drop the displaytag-version.jar file in your application WEB-INF/lib directory
2.Make sure that following libraries are in your WEB-INF/lib directory (or made available via the classpath to your application server). Refer to the dependencies document for the correct version of these libraries. The following is the list of dependencies:

  • commons-logging
  • commons-lang
  • commons-collection
  • commons-beanutils
  • log4j
  • 3.Include this tag in the JSP File

    <%@ taglib uri=”http://displaytag.sf.net” prefix=”display”%>

    4.Using Display tag the Code is:
    1.Header Data Can be given in title and Corresponding Display data will be given in property in display:column tag
    Ex:

    <display:column property=”name” title=”Name”/>

    2.Array List name will be given in name,Default page Size will be given in pagesize and id will denote arraylist variable in display:table tag

    <display:table name=”requestScope.arraydetails” defaultsort=”7″ defaultorder=”ascending” pagesize=”10″ id=”list” requestURI=”" >

    <display:setProperty name=”paging.banner.group_size”<5>/display:setProperty>
    <display:setProperty name=”css.tr.even”<even_grid>/display:setProperty>
    <display:setProperty name=”css.tr.odd”<odd_grid>/display:setProperty>
    <display:setProperty name=”basic.msg.empty_list” value=” ” / >
    <display:setProperty name=”paging.banner.one_item_found” value=” ” />
    <display:setProperty name=”paging.banner.all_items_found” value=”Page ” />
    <display:setProperty name=”paging.banner.some_items_found” value=” ” />
    <display:setProperty name=”paging.banner.no_items_found” value=” ” />
    <display:setProperty name=”paging.banner.placement” value=”bottom” />

    <display:column property=”name” title=”Name”/>
    <display:column property=”age” title=”Age”/>
    <display:column property=”designation” title=”Designation”/>

    </display:table >

    Popularity: 6% [?]

    What Is ASP.Net?

    ASP.NET is a web application framework built on the common language runtime used to build dynamic web sites, web applications and XML web services.ASP.NET is the next generation ASP, but it’s not an upgraded version of ASP.

    ASP.NET is a program that runs inside IIS and is a part of Microsoft’s .NET platform. ASP.NET allows you to use a full featured programming language such as C# (pronounced C-Sharp) or VB.NET to build web applications easily. An ASP.NET file has the file extension “.aspx” .

    ASP.NET makes it simple to use XML for data storage, configuration and manipulation. The tools which are built into ASP.NET for working with XML are very easy to use.
    Best of all, ASP.NET pages work in all browsers including Netscape, Opera, AOL, and Internet Explorer.

    Visual Studio 2005 adds the productivity of Visual Basic-style development to the Web. Now you can visually design ASP.NET Web Forms using familiar drag-drop-double-click techniques, and enjoy full-fledged code support including statement completion and color-coding. VS.NET also provides integrated support for debugging and deploying ASP.NET Web applications.

    Popularity: 1% [?]

    What is Server-side scripting?

    Server-side scripting is a web server technology where the script runs directly on the web server to generate dynamic HTML pages.While client-side scripting runs by the viewing browser.

    Server-side scripting Provide’s security since your server code cannot be viewed from a browser.With server-side scripting,you can Dynamically edit, change or add any content to a Web page and can access databases and return the results to a browser.

    eg: ASP,PHP..

    Popularity: 1% [?]

    JSP Applet tag

    How to Include Applet Program in a JSP Page:

    1.Create a Applet Java Program

    sample.java

    import javax.swing.JApplet;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;  
     
    public class sample extends Applet {
     
    sampleCanvas canvas;       // The drawing area to display arcs
    public static String s=null;
     
    public void init() {
    setLayout(new BorderLayout());
    canvas = new sampleCanvas();
    add("Center", canvas);
    s=this.getParameter("data");
    }
     
    public void destroy() {
    remove(canvas);
    }
     
    public void start() {
    }
     
    public void stop() {
    }
     
    public void processEvent(AWTEvent e) {
    if (e.getID() == Event.WINDOW_DESTROY) {
    System.exit(0);
    }
    }
     
    }
     
    class sampleCanvas extends Canvas {
    font = new java.awt.Font("SansSerif", Font.PLAIN, 12);
     
    public void paint(Graphics g) {
    Rectangle r = getBounds();
     
    if(sample.s==null)
    sample.s="0";
    int a = Integer.parseInt(sample.s);
    a=(a*600)/1000;
     
    g.fillRect(10, 200,a, 25);
     
    }
     
    public void redraw(int value) {
    this.filled = filled;
    this.startAngle = value;
    repaint();
    }
    }

    2.Complie the Applet Program

    3.Import the applet Program in the JSP File

    <%@page import="com.sample">

    4.Include this Tag in the JSP File

    <jsp:plugin type="applet" code="sample.class" width="620" height="450">
    <jsp:params>
    <jsp:param name="data" value="10"/>
    </jsp:params>
    </jsp:plugin> 

    Popularity: 2% [?]

    JSP Custom tags Example


    Custom tags are usually distributed in the form of a tag library, which defines a set of related custom tags and contains the objects that implement the tags.

    A Simple Custom tags Example:

    1.Create a Java Program

    2.import javax.servlet.jsp.*,javax.servlet.jsp.tagext.* packages

    3.Extends the TagSupport Class

    4.Java Program Contain two Default Methods.
    a)doStartTag
    b)doEndTag

    doStartTag:
    1.The doStartTag method is invoked when the start tag is encountered
    2.This method returns SKIP_BODY because a simple tag has no body

    doEndTag:
    1.The doEndTag method is invoked when the end tag is encountered
    2.This method returns SKIP_BODY because a simple tag has no body

    TagClass.java

    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;

    public class TagClass extends TagSupport{

    private String data=null;

    public void setData(String value){
    data= value;
    }

    public String getData(){
    return(data);
    }

    public int doStartTag()throws JspException{
    try{
    JspWriter out=pageContext.getOut();
    out.println(name);

    }catch(Exception e){}
    return SKIP_BODY;
    }

    public int doEndTag(){
    return SKIP_BODY;
    }

    }

    5.The Java Program Contain one Variable data(which has Getter and Setter Methods)

    6.Create tld File.

    7.We have to Create attribute For the Variable data

    8.Syntax For Creating attribute:

    <taglib>

    <tag>

    <attribute>
    <name>data</name>//Name Can be Same as we can given within the tags
    <required>true</required>//Requried Field Show Whether it is Mandatory or Not
    </attribute>

    <attribute>
    <name>id</name>
    <required>false</required>
    </attribute>

    </tag>

    </taglib>

    taglib.tld

    <?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
    <!DOCTYPE taglib PUBLIC “-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN” “http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd”>

    <taglib>

    <tlib-version>1.0</tlib-version>

    <jsp-version>1.2</jsp-version>

    <short-name>form</short-name>

    <tag>

    <name>Show</name>
    <tag-class>com.TagClass</tag-class>
    <body-content>JSP</body-content>
    <description>Simple Customs tags Example</description>

    <attribute>
    <name>data</name>
    <required>true</required>
    </attribute>

    </tag>

    </taglib>

    9.Create a JSP Page.

    10.Include this tag at the begining of the JSP Page

    <%@ taglib uri=”/WEB-INF/tld/taglib.tld” prefix=”custom” %>

    11.Create this Tag at the JSP Page

    <custom:Show data=”Custom Tag Example”></custom:Show>

    12.Output:

    Custom Tag Example

    Popularity: 7% [?]

    Custom tags in JSP

    Custom tags :
    Custom tags are usually distributed in the form of a tag library, which defines a set of related custom tags and contains the objects that implement the tags.

    Ex:-
    <%@ taglib uri="/WEB-INF/tld/taglib.tld" prefix="custom" %>

    what is Custom tags?

    A custom tag is a user-defined JSP language element. When a JSP page containing a custom tag is translated into a servlet, the tag is converted to operations on an object called a tag handler. The Web container then invokes those operations when the JSP page’s servlet is executed.

    Custom tags have a rich set of features. They can

    • Be customized via attributes passed from the calling page.
    • Access all the objects available to JSP pages.
    • Modify the response generated by the calling page.
    • Communicate with each other. You can create and initialize a JavaBeans component, create a variable that refers to that bean in one tag, and then use the bean in another tag.
    • Be nested within one another, allowing for complex interactions within a JSP page.

    Popularity: 1% [?]

    Sql Server Interview Questions – Part 1

    1.What Is Database ?

    Ans: A database is similar to a data file in that it is a storage place for data. Like a data file, a database does not present information directly to a user; the user runs an application that accesses data from the database and presents it to the user in an understandable format.Database systems are more powerful than data files in that data is more highly organized. In a well-designed database, there are no duplicate pieces of data that the user or application must update at the same time. Related pieces of data are grouped together in a single structure or record, and relationships can be defined between these structures and records.When working with data files, an application must be coded to work with the specific structure of each data file. In contrast, a database contains a catalog that applications use to determine how data is organized. Generic database applications can use the catalog to present users with data from different databases dynamically, without being tied to a specific data format. A database typically has two main parts: first, the files holding the physical database and second, the database management system (DBMS) software that applications use to access data. The DBMS is responsible for enforcing the database structure, including: · Maintaining relationships between data in the database. Ensuring that data is stored correctly, and that the rules defining data relationships are not violated. · Recovering all data to a point of known consistency in case of system failures.

    2.what is Relational Database ?

    Ans : Although there are different ways to organize data in a database, relational databases are one of the most effective. Relational database systems are an application of mathematical set theory to the problem of effectively organizing data. In a relational database, data is collected into tables (called relations in relational theory). A table represents some class of objects that are important to an organization. For example, a company may have a database with a table for employees, another table for customers, and another for stores. Each table is built of columns and rows (called attributes and tuples in relational theory). Each column represents some attribute of the object represented by the table. For example, an Employee table would typically have columns for attributes such as first name, last name, employee ID, department, pay grade, and job title. Each row represents an instance of the object represented by the table. For example, one row in the Employee table represents the employee who has employee ID 12345. When organizing data into tables, you can usually find many different ways to define tables. Relational database theory defines a process called normalization, which ensures that the set of tables you define will organize your data effectively.

    3.What is COMMIT & ROLLBACK statement in SQL ?

    Ans : Commit statement helps in termination of the current transaction and do all the changes that occur in transaction persistent and this also commits all the changes to the database.COMMIT we can also use in store procedure.ROLLBACK do the same thing just terminate the currenct transaction but one another thing is that the changes made to database are ROLLBACK to the database.

    4.What is SQL whats its uses and its component ?

    Ans : The Structured Query Language (SQL) is foundation for all relational database systems. Most of the large-scale databases use the SQL to define all user and administrator interactions. QL is Non-Procedural language . Its allow the user to concentrate on specifying what data is required rather than concentrating on the how to get it.

    5.What is Stored Procedure?

    Ans : A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.
    e.g. sp_helpdb, sp_renamedb, sp_depends etc.

    6.Advantages of Stored Procedure.

    Ans : – Stored procedure can reduced network traffic and latency, boosting application performance.
    - Stored procedure execution plans can be reused, staying cached in SQL Server’s memory,
    reducing server overhead.
    - Stored procedures help promote code reuse.
    - Stored procedures can encapsulate logic. You can change stored procedure code without
    affecting clients.
    - Stored procedures provide better security to your data.

    7.Difference between Function and Stored Procedure?

    Ans : UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be. UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables. Inline UDF’s can be though of as views that take parameters and can be used in JOINs and other Rowset operations. What are primary keys and foreign keys? Primary keys are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key. Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables.

    8.What is Trigger?

    Ans : A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS.Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; the DBMS automatically fires the trigger as a result of a data modification to the associated table.
    Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.
    Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is c
    alled a nested trigger.

    9.What are types of trigger?

    Ans : There are two different types of triggers in Microsoft SQL Server 2000. They are INSTEAD OF triggers and AFTER triggers.

    10.What is the difference between UNION ALL Statement and UNION ?

    Ans : The main difference between UNION ALL statement and UNION is UNION All statement is much faster than UNION,the reason behind this is that because UNION ALL statement does not look for duplicate rows, but on the other hand UNION statement does look for duplicate rows, whether or not they exist.

    11.What is cursors?

    Ans : Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis,instead of the typical SQL commands that operate on all the rows in the set at one time.
    In order to work with a cursor we need to perform some steps in the following order:
    Declare cursor
    Open cursor
    Fetch row from the cursor
    Process fetched row
    Close cursor
    Deallocate cursor

    12.Write some disadvantage of Cursor ?

    Ans : Cursor plays there row quite nicely but although there are some disadvantage of Cursor .Because we know cursor doing roundtrip it will make network line busy and also make time consuming methods. First of all select query gernate output and after that cursor goes one by one so roundtrip happen.Another disadvange of cursor are ther are too costly because they require lot of resources and temporary storage so network is quite busy.

    13.What is Index?

    Ans : An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.
    Clustered indexes define the physical sorting of a database table’s rows in the storage media. For this reason, each database table may have only one clustered index.
    Non-clustered indexes are created outside of the database table and contain a sorted list of references to the table itself.

    14.What is Identity?

    Ans : Identity (or AutoNumber) is a column that automatically generates numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID column also generates numbers,the value of this cannot be controled. Identity/GUID columns do not need to be indexed.

    15.What is the difference between clustered and a non-clustered index?

    Ans : A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
    A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

    16.What is data integrity? Explain constraints?

    Ans : Data integrity is an important feature in SQL Server. When used properly, it ensures that data is accurate, correct, and valid. It also acts as a trap for otherwise undetectable bugs within applications.
    A PRIMARY KEY constraint is a unique identifier for a row within a database table. Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table. The primary key constraints are used to enforce entity integrity.
    A UNIQUE constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The unique key constraints are used to enforce entity integrity as the primary key constraints.
    A FOREIGN KEY constraint prevents any actions that would destroy links between tables with the corresponding data values. A foreign key in one table points to a primary key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no primary keys with that value. The foreign key constraints are used to enforce referential integrity.
    A CHECK constraint is used to limit the values that can be placed in a column. The check constraints are used to enforce domain integrity.
    A NOT NULL constraint enforces that the column will not accept null values. The not null constraints are used to enforce domain integrity, as the check constraints.

    17.What are the null values in SQL SERVER ?

    Ans : Before understand the null values we have some overview about what the value is. Value is the actual data stored in a particular field of particular record. But what is done when there is no values in the field.That value is something like .Nulls present missing information. We can also called null propagation.

    18.What are the different types of Locks ?

    Ans : There are three main types of locks that SQL Server (1)Shared locks are used for operations that does not allow to change or update data, such as a SELECT statement.(2)Update locks are used when SQL Server intends to modify a page, and later promotes the update page lock to an exclusive page lock before actually making the changes.(3)Exclusive locks are used for the data modification operations, such as UPDATE, INSERT, or DELETE.

    19.What is different in Rules and Constraints ?

    Ans : Rules and Constraints are similar in functionality but there is a An little diffrence between them.Rules are used for backward compatibility . One the most exclusive diffrence is that we an bind rules to a datatypes whereas constraints are bound only to columns.So we can create our own datatype with the help of Rules and get the input according to that.

    20.What is defaults in Sql Server and types of Defaults ?

    Ans : Defaults are used when a field of columns is allmost common for all the rows for example in employe
    e table all living in delhi that value of this field is common for all the row in the table if we set this field as default the value that is not fill by us automatically fills the value in the field its also work as intellisense means when user inputing d it will automatically fill the delhi . There are two types of defaults object and definations.Object deault:-These defaults are applicable on a particular columns . These are usually deined at the time of table designing.When u set the object default field in column state this column in automatically field when u left this filed blank.Defination default:-When we bind the datatype with default let we named this as dotnet .Then every time we create column and named its datatype as dotnet it will behave the same that we set for dotnet datatype.

    21.What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?

    Ans : Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.

    22.Can you tell me the difference between DELETE &TRUNCATE commands?

    Ans : Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command.

    23.How to get which Process is Blocked in SQL SERVER ?

    Ans : There are two ways to get this sp_who and sp_who2 . You cannot get any detail about the sp_who2 but its provide more information then the sp_who . And other option from which we can find which process is blocked by other process is by using Enterprise Manager or Management Studio, these two commands work much faster and more efficiently than these GUI-based front-ends.

    24.What is the use of DBCC commands?

    Ans : DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.
    E.g. DBCC CHECKDB – Ensures that tables in the db and the indexes are correctly linked.
    DBCC CHECKALLOC – To check that all pages in a db are correctly allocated.
    DBCC CHECKFILEGROUP – Checks all tables file group for any damage.

    25.What is Collation?

    Ans : Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying casesensitivity, accent marks, kana character types and character width.

    Popularity: 1% [?]

    Dot Net Interview Questions – Part 3

    1.What is a stack? What is a heap?

    Ans : Stack is a place in the memory where value types are stored. Heap is a place in the memory where the reference types are stored.

    2.What is Boxing/Unboxing?

    Ans : Boxing is used to convert value types to object.
    E.g. int x = 1;
    object obj = x ;
    Unboxing is used to convert the object back to the value type.
    E.g. int y = (int)obj;

    3.What is globalization?

    Ans : Globalization is the process of customizing applications that support multiple cultures and regions.

    4.What is localization?

    Ans : Localization is the process of customizing applications that support a given culture and regions.

    5.What is Ilasm.exe used for?

    Ans : Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.

    6.What is Ildasm.exe used for?

    Ans : Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.

    7.What is the ResGen.exe tool used for?

    Ans : ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.

    8.What happens when you change the web.config file at run time?

    Ans : ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.

    9.Explain the AutoPostBack feature in ASP.NET?

    Ans : AutoPostBack allows a control to automatically postback when an event is fired. For eg: If we have a Button control and want the event to be posted to the server for processing, we can set AutoPostBack = True on the button.

    10.What are Master Pages?

    Ans : Master pages is a template that is used to create web pages with a consistent layout throughout your application. Master Pages contains content placeholders to hold page specific content. When a page is requested, the contents of a Master page are merged with the content page, thereby giving a consistent layout.

    11.What are the types of Caching?

    Ans : 1.Application Cache 2.Page Output Cache 3.Variable Cache


    12.Method Parameters in C#?

    Ans : 1. REF,2. OUT,3.PARAMS


    13.What’s the .NET datatype that allows the retrieval of data by a unique key?

    Ans : HashTable.

    14.How do you debug an ASP.NET Web application?

    Ans : Attach the aspnet_wp.exe process to the DbgClr debugger.

    15.What is the syntax to inherit from a class in C#?

    Ans : Place a colon and then the name of the base class.

    Example: class MyNewClass : MyBaseClass

    16.What’s a bubbled event?

    Ans : When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

    17.What does WSDL stand for?

    Ans : Web Services Description Language.

    18.Can you override private virtual methods?

    Ans : No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.

    19.What is an out parameter?

    Ans : An out parameter allows an instance of a parameter object to be made inside a method. Reference parameters must be initialised but out gives a reference to an uninstanciated object.

    20.What is recursion?

    Ans : Recursion is when a method calls itself.

    21.Name 10 C# keywords.

    Ans : abstract, event, new, struct, explicit, null, base, extern, object, this

    22.What is a DLL?

    Ans : A set of callable functions, which can be dynamically loaded.

    23.What is unsafe code?

    Ans : Unsafe code bypasses type safety and memory management.

    24.How would you read and write using the console?

    Ans : Console.Write, Console.Writ
    eLine, Console.Readline

    25.What’s the difference between // comments, /* */ comments and /// comments?

    Ans : Single-line comments, multi-line comments, and XML documentation comments.

    Popularity: 2% [?]

    Dot Net Interview Questions – Part 2

    1.What are server controls?

    Ans : ASP.NET server controls are components that run on the server and encapsulate user-interface and other related functionality. They are used in ASP.NET pages and in ASP.NET code-behind classes.

    2.What are Sealed Classes in C#?

    Ans : The sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class. (A sealed class cannot also be an abstract class) .

    3.What is the difference between Array and Arraylist?

    Ans : As elements are added to an ArrayList, the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling TrimToSize or by setting the Capacity property explicitly.

    4.What is Jagged Arrays?

    Ans : A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an “array-of-arrays.”

    5.Which method is used to redirect the user to another page without performing a round trip to the client?

    Ans : Server.Transfer method.

    6.Is it possible to debug java-script in .NET IDE? If yes, how?

    Ans : Yes, simply write “debugger” statement at the point where the breakpoint needs to be set within the javascript code and also enable javascript debugging in the browser property settings.

    7.How many ways can we maintain the state of a page?

    Ans : Client Side – Query string, hidden variables, viewstate, cookies

    Server side – application , cache, context, session, database.

    8.Will the finally block be executed if an exception has not occurred?

    Ans : Yes it will execute.

    9.What is the base class of all web forms?

    Ans : System.Web.UI.Page .

    10.Can we force the garbage collector to run?

    Ans : Yes, using the System.GC.Collect(), the garbage collector is forced to run in case required to do so.

    11.What does the virtual keyword in C# mean?

    Ans : The virtual keyword signifies that the method and property may be overridden.

    12.Whats the difference between web.config and app.config?

    Ans : Web.config is used for web based asp.net applications whereas app.config is used for windows based applications.

    13.What is the difference between a session object and an application object?

    Ans : A session object can persist information between HTTP requests for a particular user, whereas an application object can be used globally for all the users.

    14.Is it possible to perform forms authentication with cookies disabled on a browser?

    Ans : No, it is not possible.

    15.Which control has a faster performance, Repeater or Datalist?

    Ans : Repeater.

    16.What technique is used to figure out that the page request is a postback?

    Ans : The IsPostBack property of the page object may be used to check whether the page request is a postback or not. IsPostBack property is of the type Boolean.

    17.How can we force a thread to sleep for an infinite period?

    Ans : Call Thread.Sleep(Timeout.Infinite) .

    18.What’s the difference between Response.Write() andResponse.Output.Write()?

    Ans : Response.Output.Write() allows you to write formatted output.


    19.Describe the difference between inline and code behind.

    Ans : Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

    20.What is the lifespan for items stored in ViewState?

    Ans : Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

    21.What is PostBack & Callback?

    Ans : One technique that current ASP.NET 1.0/1.1 developers use to overcome this postback problem is to use the Microsoft XMLHTTP ActiveX object to send requests to server-side methods from client-side JavaScript. In ASP.NET 2.0, this process has been simplified and encapsulated within the function known as the Callback Manager. The ASP.NET 2.0 Callback Manager uses XMLHTTP behind the scenes to encapsulate the complexities in sending data to and from the servers and clients. And so, in order for the Callback Manager to work, you need a web browser that supports XMLHTTP. Microsoft Internet Explorer is, obviously, one of them.

    22.What is singlecall and singleton ?

    Ans : Differneces between Single Call &a
    mp; Singleton. Single Call objects service one and only one request coming in. SingleCall objects are useful in scenarios where the objects are required to do afinite amount of work. Single Call objects areusually not required to store state information, and they cannot hold state information between method calls. However, SingleCall objects can be configured in aload-balanced fashion.

    Singleton objects are those objects that service multiple clients and hence share data by storing state information between client invocations. They are useful in cases in which data needs tobe shared explicitly between clients and also in which the overhead of creating and maintaining objects is substantial.

    23.What is Machine.config File ?

    Ans : As web.config file is used to configure one asp .net web application, same way Machine.config file is usedto configure application according to a particular machine. That is, configuration done in machine.configfile is affected on any application that runs on a particular machine. Usually, this file is not alteredand only web.config is used which configuring applications.

    24.What debugging tools come with the .NET SDK?

    Ans : 1. CorDBG – command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch.

    2. DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR.

    25.What does assert() method do?

    Ans : In debug compilation, assert takes in a Boolean condition as a parameter, and shows the errordialog if the condition is false. The program proceeds without any interruption if the conditionis true.

    Popularity: 13% [?]

    Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars