You are on page 1of 8

1. Choose the form in which Postback occurs. HTMLForms. Webforms, Winforms 2.

______________ is the DataType return in IsPostback property bit, Boolean, object, string 3.Web.config file is used... To store the global information and variable definitions for the application 4. What does ASP stand for? Active Server Pages 5. ASP server scripts are surrounded by delimiters, which? <%...%> 6. How do you write "Hello World" in ASP Response.Write("Hello World") 7. "<%=" is the same as: <%Response.Write 8. What is the default scripting language in ASP? VBScript 9. How can you script your ASP code in JavaScript? Start the document with: <%@ language="javascript" %;> 10. .How do you get information from a form that is submitted using the "get" method? Request.QueryString 11. How do you get information from a form that is submitted using the "post" method? Request.Form 12. <a href="page2.asp?color=green">Go</a><br%> How can page2.asp get the "color" parameter? Response.QueryString("color") 13. Which ASP property is used to identify a user? An ASP Cookie 14. What is the correct way to include the file "" ? <!--#include file=""--> 15. Which one of these events is a standard Global.asa event? Application_OnStart 16. Global.asa is required for all Web sites False 17. Which of these objects is NOT an ASP component LinkCounter, File Access, AdRotator, Counter 18. ASP comes with a standard component that displays a different advertisement each time a user enters or refreshes a page, what is the name of this component? AdRotator 19. How do you create a FileSystemObject? Server.CreateObject("Scripting.FileSystemObject") 20. Where does ASP code execute? On the web server 21. What important standard is used to connect client browsers with web servers ? TCP/IP 22. What ASP.NET object is used to get information about the web servers ? The Server object 23. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time ? Synchronize(),Lock() and UnLock(),Lock(),Asynchroize() 24. What HTML element is the asp:Label control rendered as when the target is Internet Explorer ? <label>,<span>,<div>,<table> 25. Given an ASP.NET Web Form called WebForm1, what class does the WebForm1 class inherit from by default ? System.Web.Form, System.Web.GUI.Page, System.Web.UI.Page, System.Web.UI.Form 26. What is the Web.config file used for ? To store the global information and variable definitions for the application, To configure the web server, To configure the web browser 27. What is used to validate complex string patterns like an e-mail address ? Regular expressions 28. Which .net Data Provider offers best performance when connected to SQLServer Database ?

OLEDB provider, ODBC provider, SQLServer .NET Data Provider, SQLServer Data provider 29. What is the Best approach that has to be used, if you need continuous connection to the Database ? ADO.NET, ADO, Both, None of the above 30. Which of the following statements is true about Dataset ? Dataset can store only one table in its cache, Dataset cannot store any tables in the cache, Dataset stores tables in the when cache set to true, Dataset can store multiple tables in cache 31. The Databases that make up the data in a dataset Should be from Single database source, Can be from multiple databases bases which are homogeneous, Can include many heterogeneous databases sources 32. . In ADO, the data from one component to other is sent in Binary format, where as in ADO.Net it is sent in Binary format only, Text Stream, XML Format, None of the above 33. Which object of has the best performance,for retrieving the data DataSet, DataReader, Data Provider, Dataadapter 34. . No of records in memory at any given point of time when the DataReader reads the Data All reacords pulled by the reader, Only one record at a time, Depends on the data provider 35. Which of the following Namespace is used for better performance when connecting to SQLServer ? System.Data, System.Data.SQLClient, System.Data.Oledb, System.Data.OracleClient 36. . If the DSN (Data Source Name) has to be used with SQL Server, which namespace has to be imported ? System.Data.SQLClient, Sytem.Data.ODBC, System.Data.OracleClient, System.Data.Oledb 37. When we need to retrieve only a single value from the Database,which Method is efficient ExecuteReader(),ExecuteScalar(),ExecuteNonQuery(),ExecuteXmlReader() 38. . If we are not returning any records from the database which method is used ExecuteReader (),ExecuteScalar (),ExecuteXmlReader(),ExecuteNonQuery() 39. OLEDB Connection Pooling is handled by OLEDB.Net Provider and SQLClient Connection pooling is handled by Windows 2000 Component Service 40. Which object in ADO.Net is similar to the Recordset object of ADO ? DataReader 41. To populate the data set, which methord of DataAdapter is used GetData(),FillData(),FillDataset(),Fill() 42. Which is the parent class of the Web server control? The System.Web.Ul.Control class is the parent class for all Web server controls 43. .What is the difference between excute query and excute nonquery.? execute query is used for DDL commands whereas execute nonquery for DML. In for Command Object you have 3 methods 1.ExecuteReader - Select statements 2.ExecuteNonQuery - DML statements(Insert,Update and Delete) - Returns Number of rows affected 3.ExecuteScalar - Returns a single value from Aggregate functions like SUM,AVG,COUNT etc 44. What methods are fired during the page load? Init() - when the page is instantiated Load() - when the page is loaded into server memory PreRender() - the brief moment before the page is displayed to the user as HTML Unload() - when page finishes loading 45. What is meant by 3-tier architecture. We generally split our application into 3-Layers 1)Presentation Layer ( Where we keep all web forms Master Pages and User Controls).


2)Business Layer (Where we keep business logic). e.g Code related to manipulating data Custom Exception classes Custom Control classes Login related code if any etc. etc. 3)Data Access Layer (Where we keep code used to interact with DB). e.g. We can have the methods which are using SQL Helper (Application Block). 46. Which is the parent class of the Web server control? The System.Web.Ul.Control class is the parent class for all Web server controls. 47. Is there any limit for query string? means what is the maximum size?.. Servers should be cautious about depending on URI lengths above 255 bytes because some older client or proxy implementations

may not properly support these lengths.Query string length depends on browser compatability IE supports upto 255Firefox supports upto 4000 48. Explain the life cycle of an ASP .NET page.? Following are the events occur during ASP.NET Page Life Cycle: 1)Page_PreInit 2)Page_Init 3)Page_InitComplete 4)Page_PreLoad 5)Page_Load 6)Control Events 7)Page_LoadComplete 8)Page_PreRender 9)SaveViewState 10)Page_Render 11)Page_Unload Among above events Page_Render is the only event which is raised by page. So we can't write code for this event. 49. what events will occur when a page is loaded? Below are the events occures during page load. 1) Page_PreInit 2) Page_Init 3) Page_InitComplete 4) Page_PreLoad 50. Response.Expires This property specifies the number of minutes before a page cached in the browser expires ie. if the user returns to the same page before the specified number of minutes the cached version of the page is displayed. <% Response.Expires = minutes %> Response.ExpiresAbsolute Using this property we can set the date and/or time at which page cached in the browser expires. <% Response.ExpiresAbsolute=#May 15, 1999 18:00:00# %> 51. Where is the View state Data stored? ViewState data is stored in the hidden field. When the page is submitted to the server the data is sent to the server in the form of hidden fields for each control. If th viewstate of the control is enable true the value is retained on the post back to the client when the page is post backed..

52. What is the use of AutoWireup in AutoEventWireup attribute is used to set whether the events needs to be automatically generated or not. In the case where AutoEventWireup attribute is set to false (by default) event handlers are automatically required for Page_Load or Page_Init. However when we set the value of the AutoEventWireup attribute to true the ASP.NET runtime does not require events to specify event handlers like Page_Load or Page_Init. 53. What are the different types of sessions in ASP.Net? Name them.? Session Management can be achieved in two ways 1)InProc 2)OutProc OutProc is again two types 1)State Server 2)SQL Server InProc Adv.:

1) Faster as session resides in the same process as the application 2) No need to serialize the data DisAdv.: 1) Will degrade the performance of the application if large chunk of data is stored 2) On restart of IIS all the Session info will be lost State Server Adv.: 1) Faster then SQL Server session management 2) Safer then InProc. As IIS restart won't effect the session data DisAdv.: 1) Data need to be serialized 2) On restart of ASP.NET State Service session info will be lost 3)Slower as compared to InProc SQL Server Adv.: 1) Reliable and Durable 2) IIS and ASP.NET State Service restart won't effect the session data 3) Good place for storing large chunk of data DisAdv.: 1) Data need to be serialized 2) Slower as compare to InProc and State Server 3)Need to purchase Licensed version of SQL Server. 54. What is CLR (Common Language Runtime)? This is an execution engine for .NET Framework application. It provides a number of services including 1. Code Management 2. Application memory isolation 3. Verification of type safety 4. Conversion of IL to native code. 5. Access to meta data 6. Managing memory for managed objects 7. Enforcement of code access security 8. Exception handling, including cross-language exceptions. 9. Inter operation between managed code, COM objects and pre-existing DLLs (Unmanaged code and data) 10. Automation of object layout 11. Support for developer services (profiling, debugging etc.) 55. ASP.NET Page is very slow. What will you do to make it fast 1. Find out which is slow, is it the application or the database : If the page is executing SQL queries or stored procedures, run those on the database and check how long do they take to run. If the queries are taking most of the time, then you know you have to tune the queries for better performance. To tune the queries, there are several ways and I have listed some of them below. a) Check if there are indexes to help the query b) Select only the required columns, avoid Select *. c) Check if there is a possiblity to reduce the number of joins d) If possible use NO LOCK on your select statements e) Check if there are cursors and if you can replace them with joins 2. If the queries are running fast, then we know it is the application code that is causing the slowness. Isolate the page event that is causing the issue by turning tracing on. To turn tracing on, set Trace="true" in the page directive. Once you have tracing turned on you should see trace information at the bottom of the page as shown in the image below. In this case Page Load event is taking the maximum time. So we know, the code inPage_Load event is causing the issue. Once you look at the code, you should be able to nail down the issue. 56.What is Microsoft ADO.NET?

Visual Studio .NET provides access to databases through the set of tools and namespaces collectively referred to as Microsoft ADO.NET 57.What are the 3 major types of connection objects in ADO.NET? OleDbConnection object : Use an OleDbConnection object to connect to a Microsoft Access or third-party database, such as MySQL. OLE database connections use the OleDbDataAdapter object to perform commands and return data. SqlConnection object : Use a SqlConnection object to connect to a Microsoft SQL Server database. SQL database connections use the SqlDataAdapter object to perform commands and return data. OracleConnection object : Use an OracleConnection object to connect to Oracle databases. Oracle database connections use the OracleDataAdapter object to perform commands and return data. This connection object was introduced in Microsoft .NET Framework version 1.1. 58.List the 4 common ADO.NET Namespaces? System.Data : Contains Classes, types, and services for creating and accessing data sets and their subordinate objects System.Data.SqlClient : Contains Classes and types for accessing Microsoft SQL Server databases System.Data.OracleClient : Contains Classes and types for accessing Oracle databases (Microsoft .NET Framework version 1.1 and later) System.Data.OleDb : Contains Classes and types for accessing other databases 59.List all the steps in order, to access a database through ADO.NET? 1. Create a connection to the database using a connection object. 2. Invoke a command to create a DataSet object using an adapter object. 3. Use the DataSet object in code to display data or to change items in the database. 4. Invoke a command to update the database from the DataSet object using an adapter object. 5. Close the database connection if you explicitly opened it in step 2 using the Open method. Invoking commands without first invoking the Open method implicitly opens and closes the connection with each request. 60.Can you inherit from SqlConnection Class? No, you cannot inheirt from SqlConnection Class. SqlConnection Class is a sealed class. It is a compile time error. 60.Will the connection be closed, if the SqlConnection object goes out of scope? No, If the SqlConnection goes out of scope, it won't be closed. Therefore, you must explicitly close the connection by calling Close or Dispose. What are different page navigation techniques in ASP.NET? Hyperlink control : Navigate to another page. Response.Redirect : Navigate to another page from code. This is equivalent to clicking a hyperlink. Server.Transfer : End the current Web form and begin executing a new Web form. This method works only when navigating to a Web Forms page (.aspx). Server.Execute : Begin executing a new Web form while still displaying the current Web form. The contents of both forms are combined. This method works only when navigating to a Web Forms page (.aspx). Window.Open script method : Display a page in a new browser window on the client. What is the difference between Response.Redirect and Server.Transfer? 1. When we use Server.Transfer the redirection happens on the server where as when we use Response.Redirect the redirection happens from the browser. 2. Server.Transfer is faster as there is no round trip involved while navigating from one webform to another webform.Response.Redirect is slower than Server.Transfer as there is round trip from the server to the client browser. 3. Server.Transfer works only with .aspx files where as Response.Redirect works with .aspx and .Htm pages. 4. Server.Transfer will work with files on the same web server. You can't use Server.Transfer to send the user to an external site where as Response.Redirect can do that. 5. Server.Transfer does not update the URL in the browser. For example when you navigate from WebForm1.aspx to WebForm2.aspx using Server.Transfer the URL in the browser still shows WebForm1.aspx while you are actually looking at WebForm2.aspx. Response.Redirect updates the URL in the browser. What are Master Pages in ASP.NET? or What is a Master Page?

ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the pages (or a group of pages) in your application. You can then create individual content pages that contain the content you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. What is a ContentPlaceHolder? ContentPlaceHolder is a region where replaceable content will appear Give an example of using querystrings to send data from one page to another? Query strings are a very simple and popular technique to pass data from one Web page to the next. You send data as part of the URL. In the below example FName and LName are sent as part of the URL. In the page load of QueryStrings2.aspx we use Request.QueryString to read the values. As we are sending more than one query string we use the & symbol to seperate query strings. //Code to send query strings FName and LName as part of the URL QueryStrings2.aspx?FName=David&LName=Boon protected void Page_Load(object sender, EventArgs e) { //Code to read Query String values string FirstName = Request.QueryString["FName"]; string LastName = Request.QueryString["LName"]; Response.Write("Data from QueryStrings1.aspx : " + FirstName + ", " + LastName); } Give an example to send Query Strings from code? You can send query strings from server side code using the Response.Redirect() method as shown below. Response.Redirect("QueryStrings2.aspx?FName=David&LName=Boon"); What are the advantages of using Query Strings? 1. Query strings are easy to implement. 2. Browser support for passing values in a query string is nearly universal. 3. Query strings are contained in the HTTP request for a specific URL and do not require server resources. What are the disadvantages of using querystrings to send data from one page to another? 1. Query strings are insecure because the information in the query string is directly visible to the user on the address line in the browser. 2. Many browsers impose a 255 URL character limit which can limit their flexibility JAVA 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java code in one platform (eg Windows) and can execute the class in any other supported platform eg (Linux,Solaris,etc). 3. What is a JVM? JVM is Java Virtual Machine which is a run time environment for the compiled java class files.

4. Are JVM's platform independent? JVM's are not platform independent. JVM's are platform specific run time implementation provided by the vendor. 5. What is the difference between a JDK and a JVM? JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM. 6. What is a pointer and does Java support pointers? Pointer is a reference handle to a memory location. Improper handling of pointers leads to memory leaks and reliability issues hence Java doesn't support the usage of pointers. 7. What is the base class of all classes? java.lang.Object 8. Does Java support multiple inheritance? Java doesn't support multiple inheritance. 9. Is Java a pure object oriented language? Java uses primitive data types and hence is not a pure object oriented language. 10. Are arrays primitive data types? In Java, Arrays are objects. 11. What is difference between Path and Classpath? Path and Classpath are operating system level environment variales. Path is used define where the system can find the executables(.exe) files and classpath is used to specify the location .class files. 12. What are local variables? Local varaiables are those which are declared within a block of code like methods. Local variables should be initialised before accessing them. 13. What are instance variables? Instance variables are those which are defined at the class level. Instance variables need not be initialized before using them as they are automatically initialized to their default values. 14. How to define a constant variable in Java? The variable should be declared as static and final. So only one copy of the variable exists for all instances of the class and the value can't be changed also.

static final int PI = 2.14; is an example for constant. 15. Should a main() method be compulsorily declared in all java classes? No not required. main() method should be defined only if the source class is a java application. 16. What is the return type of the main() method? Main() method doesn't return anything hence declared void. 17. Why is the main() method declared static? main() method is called by the JVM even before the instantiation of the class hence it is declared as static. 18. What is the arguement of main() method? main() method accepts an array of String object as argument
19. Can a main() method be overloaded? Yes. You can have any number of main() methods with different method signature and implementation in the class. 20. Can a main() method be declared final? Yes. Any inheriting class will not be able to have it's own default main() method. 21. Does the order of public and static declaration matter in main() method? No. It doesn't matter but void should always come before main(). 22. Can a source file contain more than one class declaration? Yes a single source file can contain any number of Class declarations but only one of the class can be declared as public. 23. What is a package? Package is a collection of related classes and interfaces. package declaration should be first statement in a java class. 24. Which package is imported by default?

java.lang package is imported by default even without a package declaration.