ASP.NET General Test Questions
- How many global.asax file a web application can have? Ans: 1 and it must reside in the root directory.
- What is the correct event to access controls and their values? Ans:
- Which property of the page class can be used to check if the page is being loaded first time? Ans: IsPostBack (Web pages usually contains a form that when submitted, send the values of all controles to the server and causes the current page to be requested again. This event is known as a postback. IsPostBack property of the class page is used to determine wether the page is being loaded due to a postback. The first time that the web page is requested, IsPostBack is False, and the page displays only the form for the user input. When the postBack occures, IsPostback is True.)
- Which of the following are intrinsic objects of page class? Asns: Session (In ASP.NET, familiar intrinsic objects such as Request, Response, Server, Application, and Session are still part of ASP.NET and are used in much the same way as they were in ASP.)
- Wht is the web.config setting to enable trace output? Ans: <compilation debug="true"/> Every web applicaton inherits the settings from the machine.config file. ASP.net uses multilayered configuration system that allows you to use different settings for different parts of your application. Sub directories can contain their own web.config files with additional settings. ASP.NEt uses configuraton inheritance so that each sub directory acquires the settings from the parent directory.
- To display custome error message what is the setting of the web.config file? Ans: <customErrors
mode="RemoteOnly"
/>
- What are the type of validators in ASP.net?
- RequiredFieldValidator
- RangeValidator
- Comparevalidator
- RegularExpressionValidator
- CustomValidator
- ValidationSummary
- What is the file extention for User Control? Ans:.ascx
- What is the method used to load the data in data-bound control? Ans: DataBind();
- Which class uses Fill() method to populate a dataset? Ans: DataAdapter
- Which class provides the forward only access to the data being retrived from the database? Ans:
- When you need to access data that is disconnected from a data store and pass the data to another tier what should you use from the list(dataReader, Dataset, DataGrid, dataFile)? Ans:
- What will the following code do? Code: objDataReader=objCommand.ExecuteReader( CommandBehaviour.CloseConnection); Ans: