ASPNET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services It is a part of NET Framework You can create ASPNET applications in most of the NET compatible languages, such as Visual Basic, C#, and J# The ASPNET compiles the Web pages and provides much better performance than scripting languages, such as VBScript The Web Forms support to create powerful forms-based Web pages You can use ASPNET Web server controls to create interactive Web applications With the help of Web server controls, you can easily create a Web application
Correct Answer: DLR is a runtime environment that allows you to integrate dynamic languages with the Common Language Runtime (CLR) by adding a set of services, such as expression trees, call site caching, and dynamic object interoperability to the CLR The SystemDynamic and SystemRuntimeCompilerServices namespaces are used to hold the classes for DLR It also provides dynamic features to statically-typed languages, such as C# and Visual Basic to enable their interoperation with dynamic languages
2. What are the usages of the Command object in ADO.NET?
Correct Answer: The following are the usages of the Command object in AD0NET: The Command object in AD0NET executes a command against the database and retrieves a DataReader or DataSet object => It also executes the INSERT, UPDATE, or DELETE command against the database => All the command objects are derived from the DbCommand class => The command object is represented by two classes: SqlCommand and OleDbCommand => The Command object provides three methods to execute commands on the database: => The ExecuteNonQuery() method executes the commands and does not return any value => The ExecuteScalar() method returns a single value from a database query => The ExecuteReader() method returns a result set by using the DataReader object
3. What are the usages of the Command object in ADO.NET?
Correct Answer: The following are the usages of the Command object in AD0NET: The Command object in AD0NET executes a command against the database and retrieves a DataReader or DataSet object => It also executes the INSERT, UPDATE, or DELETE command against the database => All the command objects are derived from the DbCommand class => The command object is represented by two classes: SqlCommand and OleDbCommand => The Command object provides three methods to execute commands on the database: => The ExecuteNonQuery() method executes the commands and does not return any value => The ExecuteScalar() method returns a single value from a database query => The ExecuteReader() method returns a result set by using the DataReader object
Correct Answer: ADONET is a very important feature of NET Framework, which is used to work with data that is stored in structured data sources, such as databases and XML files The following are some of the important features of ADONET: => Contains a number of classes that provide you with various methods and attributes to manage the communication between your application and data source => Enables you to access different data sources, such as Microsoft SQL Server, and XML, as per your requirements => Provides a rich set of features, such as connection and commands that can be used to develop robust and highly efficient data services in NET applications => Provides various data providers that are specific to databases produced by various vendors For example, ADONET has a separate provider to access data from Oracle databases; whereas, another provider is used to access data from SQL databases
5. How can you prevent a class from overriding in C# and Visual Basic?
Correct Answer: You can prevent a class from overriding in C# by using the sealed keyword; whereas, the NotInheritable keyword is used to prevent a class from overriding in Visual Basic
6. What is the basic difference between ASP and ASP.NET?
Correct Answer: The basic difference between ASP and ASPNET is that ASP is interpreted; whereas, ASPNET is compiled This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted On the other hand, ASPNET uses NET languages, such as C# and VBNET, which are compiled to Microsoft Intermediate Language (MSIL)
7. How can you send an email message from an ASP.NET Web page?
Correct Answer: You can use the SystemNetMailMailMessage and the SystemNetMailSmtpMail classes to send an email in your Web pages In order to send an email through your mail server, you need to create an object of the SmtpClient class and set the server name, port, and credentials
Correct Answer: The code-behind feature of ASPNET enables you to divide an ASPNET page into two files - one consisting of the presentation data, and the second, which is also called the code-behind file, consisting of all the business logic The presentation data contains the interface elements, such as HTML controls and Web server controls, and the code-behind contains the event-handling process to handle the events that are fired by these controls The file that contains the presentation data has the aspx extension The code behind file has either the cs extension (if you are using the programming language C#) or the vb (if you are using the programming language Visual Basic NET) extension
9. Explain the validation controls. How many validation controls in ASP.NET 4.0?
Correct Answer: Validation controls are responsible to validate the data of an input control Whenever you provide any input to an application, it performs the validation and displays an error message to user, in case the validation fails ASPNET 40 contains the following six types of validation controls: => CompareValidator - Performs a comparison between the values contained in two controls => CustomValidator - Writes your own method to perform extra validation => RangeValidator- Checks value according to the range of value => RegularExpressionValidator - Ensures that input is according to the specified pattern or not => RequiredFieldValidator - Checks either a control is empty or not => ValidationSummary - Displays a summary of all validation error in a central location
Correct Answer: State is quite an innovative concept in Web development because it eliminates the drawback of losing state data due to reloading of a Web page By using states in a Web application, you can preserve the state of the application either at the server or client end The state of a Web application helps you to store the runtime changes that have been made to the Web application For example, as already described earlier, a change in the data source of the Web application might be initiated by a user when he/she selects and saves some products in the shopping cart If you are not using states, these changes are discarded and are not saved You may think that the whole concept of storing states is optional However, under certain circumstances, using states with applications is imperative For example, it is necessary to store states for Web applications, such as an e-commerce shopping site or an Intranet site of a company, to keep track of the requests of the users for the items they have selected on the shopping site or the days requested for vacation on the Intranet site