50+ TOP ASP.NET AJAX Interview Questions and Answers [UPDATED]

If you’re preparing for ASP.NET AJAX job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in ASP.NET AJAX interview, then go through the below 50+ Top ASP.NET AJAX Interview Questions and Answers to crack your job interview.

ASP.NET AJAX Interview Questions and Answers

  • Question: Briefly Describe Asp.net Ajax Framework?

    Answer :

    ASP.NET AJAX Framework provides a platform where developers can develop such type of applications that use the AJAX concept. The AJAX provides the collection of technologies to create dynamic pages at the client side. The JavaScript requests are responsible to retrieve data from the server or send data to the server. Even some processing at server also requires handling requests, such as searching and storing of data. These tasks are achieved more easily using the AJAX Framework.

    AJAX Framework is completely devoted to process requests. The objective of the AJAX engine is to reduce the delays that the user notices while performing a postback to the server. AJAX Framework allows JavaScript functions to send requests to server at the client side. On the other side, it allows the server to process the client’s request, searches data, and responds the result to the browser.

  • Question: Can We Call Server-side Code From Javascript?

    Answer :

    Yes, page methods and Web services are the two techniques to call the server-side code from JavaScript.

  • Question: Can We Nest The Updatepanel Controls?

    Answer :

    Yes, we can nest the UpdatePanel control.

  • Question: Describe Ajax Control Extender Toolkit?

    Answer :

    AJAX Control Toolkit is a set of extenders that are used to extend the functionalities of the ASP.NET controls. The extenders use a block of JavaScript code to add new and enhanced capabilities to the ASP.NET controls. AJAX Control Toolkit is a free download available on the Microsoft site. You need to install this toolkit on your system before using extenders.

  • Question: Describe The Accordionextender Control?

    Answer :

    The AccordionExtender control is similar to the CollapsiblePanelExtender control. It allows you to group multiple collapsible panels in a single control. At the same time, it also manages the collapsed and expanded state of each panel; therefore, expanding one panel at a time. In other words, the AccordionExtender control does not support expanding two or more panels simultaneously. Instead, the header templates of all the panels are always visible so that you can click on any of them to display the hidden contents. By default, the AccordionExtender control opens with one panel as expanded.

  • Question: Describe The Situations In Which Ajax Should Not Be Used?

    Answer :

    You should not use AJAX if:

    1. You want the page to show in a search engine, such as Google, because WebCrawler does not execute JavaScript code.
    2. The browser does not support JavaScript.
    3. You want to create a secure application.
  • Question: Explain The Limitations Of Ajax?

    Answer :

    The following are the limitations of AJAX:

    • It is difficult to bookmark a particular state of the application.
    • Function provided in the code-behind file do not work because the dynamic pages cannot register themselves on browsers history engine automatically.
    • If JavaScript is disabled, then AJAX is not able to perform any work.
    • Response time may be slow because different controls of a page are loaded at different time.
  • Question: Explain The Need Of The Timer Control In Ajax?

    Answer :

    The Timer control is used with an UpdatePanel control to allow partial-page updates at a specified interval. It is mostly used when a periodically partial-page update for one or more UpdatePanel controls is required without refreshing the entire page.

    The Timer control is a server control that sets a JavaScript component in the Web page. The interval property of the Timer control specifies time in milliseconds. Similar to the UpdatePanel control, the Timer control also requires an instance of the ScriptManager control in the Web page. 

    When the Timer control initiates a postback, the Tick event is raised on the server for which you can provide an event handler to perform the actions when the page is submitted to the server. The Tick event occurs when the time specified in the interval property has elapsed and the page is posted on the server. You can add one or more Timer controls on a Web page. Usually the entire page requires only a single Timer control; however, you can use multiple Timer controls, if the UpdatePanel controls are being updated at different intervals.

  • Question: Explain The Step Property Of The Numericupdownextender Control?

    Answer :

    The Step property sets the steps for numeric increment and decrement. The default value is 1.

  • Question: Explain The Updatepanel Control?

    Answer :

    The UpdatePanel control specifies the portions of a Web page that can be updated together. As the UpdatePanel control refreshes only a selected part of the Web page instead of refreshing the entire page with a postback, you get more flexibility to create rich and client-centric Web applications.

    Refreshing a selected part of the Web page is referred as partial-page update. You can add one or more UpdatePanel control in the Web page, which automatically participates in partial-page update without custom client script. The UpdatePanel control uses the UpdatePanel class to support the partial-page rendering.

  • Question: How Can We Get The State Of The Requested Process?

    Answer :

    XMLHttpRequest get the current state of the request operation by using the readyState property. This property checks the state of the object to determine if any action should be taken. The readyState property uses numeric values to represent the state.

  • Question: How Can You Find Out That An Ajax Request Has Been Completed?

    Answer :

    You can find out that an AJAX request has been completed by using the readyState property. If the value of this property equals to four, it means that the request has been completed and the data is available.

  • Question: How Many Validation Controls Are Available In Asp.net Ajax 4.0?

    Answer :

    The following validation controls are available in ASP.NET AJAX 4.0:

    • FilteredTextBoxExtender – Enables you to apply filtering to a text box.
    • MaskedEditExtender and MaskedEditValidator – Restricts a user to enter only a certain pattern of characters in the TextBox by applying a mask to the input.
    • ValidatorCalloutExtender – Attaches to the ASP.NET validators so that the error messages are not displayed as a simple text but as a balloon-style ToolTip.
    • NoBot – Prevents the spam/bot from filling the input forms automatically and uses the Completely Automated Public Turing test to tell Computers and Humans Apart (CAPTCHA), which is a type of challenge-response test to ensure that the response is not generated by the computer.
    • PasswordStrengthExtender – Measures the strength of the password text entered within the text box by validating with the different strength specified parameters
  • Question: Is It Possible To Use Multiple Scriptmanager Controls On A Web Page?

    Answer :

    No, it is not possible.

  • Question: Is The Ajaxcontroltoolkit.dll File Installed In The Global Assembly Cache?

    Answer :

    No, you have to copy this file to the Bin folder of your application.

  • Question: Is There Any Difference Between Html And Xhtml?

    Answer :

    Extensible HTML (XHTML) is a markup language that provides the mixture expressions of HTML and XML. XHTML is a flexible markup language that enables automated processing by standard XML tools, which was difficult in HTML.

  • Question: List The Different States Of Xmlhttprequest With Their Description?

    Answer :

    The different states of the XMLHttpRequest object are as follows:

    • Uninitialized – Refers to the state when the object has not been initialized.
    • Open – Refers to the state when the object has been created; however, the send function has not been invoked.
    • Sent -Refers to the state when the send function is invoked; however, the status and headers are not available.
    • Receiving – Refers to the state when the process is receiving data.
    • Loaded – Refers to the state when the procedure is completed and the entire data is available.
  • Question: What Are The Components Of The Asp.net Ajax Architecture?

    Answer :

    You can divide the ASP.NET AJAX architecture into two components – AJAX client architecture and AJAX server architecture.

  • Question: What Are The Differences Between Ajax And Javascript?

    Answer :

    The differences between AJAX and JavaScript are given as follows:

    • AJAX sends request to the server and does not wait for the response. It performs other operations on the page during that time. JavaScript make a request to the server and waits for response.
    • AJAX does not require the page to refresh for downloading the whole page while JavaScript manages and controls a Web page after being downloaded.
    • AJAX minimizes the overload on the server since the script needs to request once while JavaScript posts a request that updates the script every time.
  • Question: What Are The Different Controls Of Asp.net Ajax?

    Answer :

    ASP.NET AJAX includes the following controls:

    • ScriptManager
    • ScriptManagerProxy
    • UpdatePanel
    • UpdateProgress
    • Timer
  • Question: What Are The Different Ways To Pass Parameters To The Server?

    Answer :

    We can pass parameters to the server using either the GET or POST method.

    The following code snippets show the example of both the methods:

    Get: XmlHttpObject.Open(“GET”, “file1.txt”, true);

    Post: XmlHttpObject.Open(“POST”, “file2.txt”, true);

  • Question: What Are The Extender Controls?

    Answer :

    The extender controls uses a block of JavaScript code to add new and enhanced capabilities to ASP.NET. The developers can use a set of sample extender controls through a separate download – AJAX Control Toolkit (ACT).

  • Question: What Are The New Controls Introduced In Asp.net Ajax Control Toolkit?

    Answer :

    The following controls are introduced with the new version of AJAX Control Toolkit:

    SeaDragonExtender control – Refers to the control that is used to deeply zoom the images. You can zoom in or out the image or the particular portion of the image by using the mouse. You can also create a menu over the Seadragon control. This control is helpful when you want to analyze the image closely.

    AsyncFileUploadExtender control – Refers to the control that provides the facility to upload and save the files on the server asynchronously. You can check the outcome either at the server or client side.

  • Question: What Are The New Features Included In The Microsoft Ajax Library?

    Answer :

    The Microsoft AJAX library is a client-based JavaScript library that is compatible with all modern browsers and offers a lot of functionality as compared to JavaScript. This library is released with new features and fully supports ASP.NET 4.0′.

    The new features included in the Microsoft AJAX library are as follows:

    • Imperative syntax – Supports simple imperative syntax that is used to create and manage controls.
    • Script loader – Retrieves all scripts that are needed by one or more client component or control automatically and executes the scripts in the order in which they are received.
    • Client data access – Supports to access client data and display by client data control and client template.
    • Client datacontext – Supports read and write permission to data from a database.
    • The AdoNetDataContext class – Enables you to easily interact with an ADO.NET Data Services service.
    • jQuery integration – Helps to access the elements in your Web pages, work with client-side events, enable visual effects, and make it easier to use AJAX in your applications.
  • Question: What Are The New Features Of Asp.net Ajax 4.0?

    Answer :

    ASP.NET 4.0 AJAX includes several new features that provide more functionality to a user.

    These features are as follows:

    • Support for live data binding.
    • Support for client-side template rendering.
    • Support for declarative instantiation of client components.
    • Support for using the observer pattern on JavaScript objects and arrays.
    • Support for invoking ADO.NET data services and data contexts.
    • Support for the DataView control.
  • Question: What Are The Requirements To Run Asp.net Ajax Applications On A Server?

    Answer :

    AJAX is a built-in functionality of .NET Framework 4.0. Therefore, you can run an AJAX application by just installing Microsoft Visual Studio 2010. However, to use extenders in your applications, you are required to install AJAX Control Toolkit and copy the AjaxControlToolkit.dll file to the Bin directory of your application.

  • Question: What Does The Dynamicpopulateextender Control Do?

    Answer :

    The DynamicPopulateExtender control populates the contents of a control dynamically. It enables you to send an asynchronous call to the server that dynamically populates the contents of a control. The DynamicPopulateExtender control replaces the contents of a control with the result of a Web service or page method call.

  • Question: What Does The Minimumprefixlength Property Of The Autocompleteextender Control Do?

    Answer :

    The MinimumPrefixLength property sets the minimum number of characters that must be entered before getting suggestions from the Web service.

  • Question: What Is Asp.net Ajax?

    Answer :

    ASP.NET AJAX, mostly called AJAX, is a set of extensions of ASP.NET. It is developed by Microsoft to implement AJAX functionalities in Web applications. ASP.NET AJAX provides a set of components that enable the developers to develop applications that can update only a specified portion of data without refreshing the entire page. The ASP.NET AJAX works with the AJAX Library that uses object-oriented programming (OOP) to develop rich Web applications that communicate with the server using asynchronous postback.

  • Question: What Is Json?

    Answer :

    JSON is an abbreviation of JavaScript Object Notation. It is a safe and reliable data interchange format in JavaScript, which is easy to understand not only for the users but also for the machines.

  • Question: What Is The Difference Between Synchronous Postback And Asynchronous Postback?

    Answer :

    The difference between synchronous and asynchronous postback is as follows:

    • Asynchronous postback renders only the required part of the page; whereas, synchronous postback renders the entire page for any postback.
    • Asynchronous postback executes only one postback at a time, that is, if you have two buttons doing asynchronous postback, the actions will be performed one by one; whereas, synchronous postback executes all the actions at once.
    • Asynchronous postback only modifies the update panel that raises the postback; whereas, synchronous postback modifies the entire page.
  • Question: What Is The Importance Of Client-side Libraries?

    Answer :

    Client-side libraries contain built-in code to make asynchronous calls over XMLHTTP. These libraries automatically handle browser compatibility issues. These libraries are based on a programming model similar to ASP.NET.

  • Question: What Is The Role Of The Scriptmanagerproxy Control?

    Answer :

    A Web page cannot contain more than one ScriptManager control. You can use the ScriptManagerProxy control to add scripts to other pages; however to perform such an operation, you need to work with a master page that contains the ScriptManager control. If you have only few pages that need to register to a script or a Web service, then you should remove these pages from the ScriptManager control and add them as individual pages by using the ScriptManagerProxy control. If you include the scripts on the master page by the ScriptManager control, then the items get downloaded on each page that extends the master page, even if they are not necessary.

  • Question: What Is The Syntax To Create Ajax Objects?

    Answer :

    AJAX uses the following syntax to create an object:

    var myobject = new AjaxObject(“page path”);

    The page path is the URL of the Web page containing the object that you want to call. The URL must be of the same domain as the Web page.

  • Question: What Is The Use Of The Scriptmanager Control In Ajax?

    Answer :

    The ScriptManager control is a core control that performs a key role in implementing the ASP.NET AJAX functionality. It helps to use JavaScript for the Microsoft AJAX Library. It should be noted that AJAX Library on a Web page can only be used if the Web page contains the ScriptManager control. This control makes use of the ScriptManager class to maintain the AJAX script libraries and script files. It allows for partial page rendering, Web service calls, and use of ASP.NET AJAX Client Library by rendering the AJAX Library scripts to the browser.

  • Question: What Is The Work Of The Conformonformsubmit Property In The Confirmbuttonextender Control?

    Answer :

    The ConformOnFormSubmit property determines whether or not the confirm dialog box should wait when the form is submitted for display.

  • Question: What Technologies Are Being Used In Ajax?

    Answer :

    AJAX uses four technologies, which are as follows:

    • JavaScript
    • XMLHttpRequest
    • Document Object Model (DOM)
    • Extensible HTML (XHTML) and Cascading Style Sheets (CSS)
  • Question: Why Do We Use The Updateprogress Control In Ajax?

    Answer :

    The UpdateProgress control is somewhat related to the UpdatePanel control. The UpdateProgress control enables you to design a user-friendly interface when a Web page consists of a number of UpdatePanel controls for partial-page rendering.

    The UpdateProgress control makes you aware of the status information about the partial-page updates in the UpdatePanel control.

  • Question: Why Do We Use The Xmlhttprequest Object In Ajax?

    Answer :

    The XMLHttpRequest object is used by JavaScript to transfer XML and other text data between client and server. The XMLHttpRequest object allows a client-side script to perform an HTTP request. AJAX applications use the XMLHttpRequest object so that the browser can communicate to the server without requiring a postback of the entire page. In earlier versions of Internet Explorer, MSXML ActiveX component is liable to provide this functionality; whereas, Internet Explorer 7 and other browsers, such as Mozilla Firefox, XMLHttpRequest is not liable to.

  • 50+ TOP ASP.NET Database Interview Questions and Answers [UPDATED]

    If you’re preparing for ASP.NET Database job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in ASP.NET Database interview, then go through the below 50+ Top ASP.NET Database Interview Questions and Answers to crack your job interview.

    ASP.NET Database Interview Questions and Answers

  • Question: Describe Session Handling In Webform. How Does It Work And What Are The Limits?
    Answer :

    Session management in ASP.NET can be done in two ways:

    • Using Cookies
    • Encoding of URLs with Session ID
  • Question: Explain Differences Between Framework 1.0 And Framework 1.1?
    Answer :

    1. Native Support for Developing Mobile Web Applications
    2. Unified Programming Model for Smart Client Application Development
    3. Enable Code Access Security for ASP.NET Applications
    4. Native Support for Communicating with ODBC and Oracle Databases
    5. Supports for IPv6
  • Question: Explain Differences Between Server.transfer And Server.execute Method?
    Answer :

    server.transfer-> transfers the server’s control to the requested page given in the parameter.

    server.Execute-> executes the requested page from the current page itself, with no change in the address bar. after execution the next line of code is executed in the current page.

     

  • Question: Explain Features Of Sql Server Like Scalability , Availability, Integration With Internet?
    Answer :

     Scalability:The same Microsoft SQL Server 2000 database engine operates on Microsoft Windows 2000 Professional, Microsoft Windows 2000 Server, Microsoft Windows 2000 Advanced Server, Windows 98, and Windows Millennium Edition. It also runs on all editions of Microsoft Windows NT version 4.0. The database engine is a robust server that can manage terabyte-sized databases accessed by thousands of users.

    Availability:SQL Server 2000 can maintain the extremely high levels of availability required by large Web sites and enterprise systems.

    Integration:The SQL Server 2000 TCP/IP Sockets communications support can be integrated with Microsoft Proxy Server to implement secure Internet and intranet communications.

  • Question: How Can You Deploy An Asp.net Application ?
    Answer :

    You can deploy an ASP.NET Web application using any one of the following three deployment options.

    1. Deployment using VS.NET installer
    2. Using the Copy Project option in VS .NET
    3. XCOPY Deployment
  • Question: How Do Sql Server 2000 And Xml Linked? What Is Sql Server Agent?
    Answer :

    Every Request or the Response to or from SQL Server is converted into XML format. Its purpose is to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows you to schedule your own jobs and scripts.

  • Question: How Do U Call And Execute A Stored Procedure In .net?
    Answer :

    1. system.Data;
    2. system.Data.SqlClient;
    3. SqlConnection sqCon = new SqlConnection(?connection string);
    4. SqlCommand sqCmd = new SqCmd();
    5. sqCmd.Connection = sqCon;
    6. sqCmd.CommandText = procedure_name;
    7. sqCmd.CommandType = CommandType.StoredProcedure;
    8. sqComd.ExecuteReader();
  • Question: How Do We Upgrade Sql Server 7.0 To 2000?
    Answer :

    Run the installation of the SQL Server 2000

    In the Existing Installation dialog box, click Upgrade your existing installation, and then click Next.

    In the Upgrade dialog box, you are prompted as to whether you want to proceed with the requested upgrade. Click Yes, upgrade my to start the upgrade process, and then click Next. The upgrade runs until finished.

    In the Connect to Server dialog box, select an authentication mode, and then click Next.

    If you are not sure which mode to use, accept the default: The Windows account information I use to log on to my computer with (Windows). In Start Copying Files dialog box, click Next.

    Now your Sql Server would be upgraded.

  • Question: How Do You Create Thread In .net?
    Answer :

    1. Import System.Threading
    2. Create a new thread using new Thread() and assign the address of the method
    3. Use Thread.Start method to start the execution

    using System;

    using System.Threading;

    public class Test
    {
    static void Main()
    {
    ThreadStart job = new ThreadStart(ThreadJob);
    Thread thread = new Thread(job);
    thread.Start();

    for (int i=0; i

  • Question: How Do You Find The Error, How Can You Know The Number Of Rows Affected By Last Sql Statement?
    Answer :

    Use @@ERROR which returns the error number for the last Transact-SQL statement executed fro knowing the error.

    Use @@ROWCOUNT which returns the number of rows affected by the last statement for finding the no of rows affected.

  • Question: How Do You Use Dbcc Statements To Monitor Various Aspects Of A Sql Server Installation?
    Answer :

    Database Consistency Checker (DBCC) – Is a statement used to check the logical and physical consistency of a database, check memory usage, decrease the size of a database, check performance statistics, and so on. Database consistency checker (DBCC) ensures the physical and logical consistency of a database, but is not corrective. DBCC can help in repairing or checking the installation in case of any failure.

  • Question: How Does You Handle This Com Components Developed In Other Programming Languages In .net?
    Answer :

    While adding the refferences we can handle the COM components in other .Net programming languages.

  • Question: If There Is A Calendar Control To Be Included In Each Page Of Your Application, And And We Do Not Intend To Use The Microsoft-provided Calendar Control, How Do You Develop It? Do You Copy And Paste The Code Into Each And Every Page Of Your Application?
    Answer :

    Create the Calendar User Control

    The control we will create will contain a calendar control and a label which has the corresponding date and time written

    Steps are:-

    Creating a CalenderControl

    1. To begin, open Visual Studio .NET and begin a new C# Windows Control Library.
    2. You may name it whatever you like, for this sample the project name will be CalenderControl

    Using the Calender Control in a Windows Application

    It’s just like adding any other control like a button or a label.

    1. First, create a new Windows Application project named: CustomControl.
    2. Add a reference to the Calender Control DLL named: CalenderControl.dll.
    3. Now you a can customize the Toolbox:

    Right-Click the Toolbox> .NET Framework Components> Browse> select the CalenderControl.dll.

    The Calender Control is now added to the Toolbox and can be inserted in Windows Form as any other control. The control itself will take care of the date display

  • Question: If We Write Any Code For Datagrid Methods, What Is The Access Specifier Used For That Methods In The Code Behind File And Why And How? Give An Example?
    Answer :

    We use Friends Modifer for the dataGrid methods. Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid

  • Question: What Are Cursors? Name Four Type Of Cursors And When Each One Would Be Applied?
    Answer :

    Opening a cursor on a result set allows processing the result set one row at a time.

    The four API server cursor types supported by SQL Server are:

    1. Static cursors
    2. Dynamic cursors
    3. Forward-only cursors
    4. Keyset-driven cursors
  • Question: What Are Good Ado.net Object(s) To Replace The Ado Recordset Object?
    Answer :

    The differences includes

    • In ADO, the in-memory representation of data is the Recordset.In ADO.net, it is the dataset
    • A recordset looks like a single table in ADO.In contrast, a dataset is a collection of one or more tables in ADO.net
    • ADO is designed primarily for connected access,ADO.net the disconnected access to the database is used
    • In ADO you communicate with the database by making calls to an OLE DB provider.
    • In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source.
    • In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database.
  • Question: What Are The Differences Between User Control And Web Control And Custom Control?
    Answer :

    Usercontrol-> control that is created as u wish.

    Web Control-> any control placed in web page (web application page)

    Custom Control-> same as user control with some difference.

    user control custome control

    • easy to create difficult
    • no full suport for customers using

    Visual studio tools Full support

    • Seperate copy of the control in each assembly only one copy in global assembly.
    • best for static layout best for dynamic layout.
  • Question: What Are The Different Types Of Replication? How Are They Used?
    Answer :

    Replication is used for distributing data and the execution of stored procedures across an enterprise. The replication technology allows you to make duplicate copies of your data, move those copies to different locations, and synchronize the data automatically so that all copies have the same data values.

    The different types of replications are:

    1. transactional replication
    2. merge replication
  • Question: What Are The Types Of Cookies Are There?
    Answer :

    Two type of cookeies.

    1   single valued

    Example: request.cookies(?UserName?).value=?Mahesh?

    2  Multivalued cookies.

    These are used in the way collections are used.

    example:

    request.cookies(?CookiName?)(?UserName?)=?Mahesh?

    request.cookies(?CookiName?)(?UserID?)=?ABC003?

    rember no value method in multivalued cookie

  • Question: What Does It Mean To Have Quoted_identifier On? What Are The Implications Of Having It Off?
    Answer :

    SET QUOTED_IDENTIFIER ON- Causes SQL Server to follow the SQL-92 rules regarding quotation mark delimiting identifiers and literal strings. Identifiers delimited by double quotation marks can be either Transact-SQL reserved keywords or can contain characters not usually allowed by the Transact-SQL syntax rules for identifiers.

  • Question: What Is An Execution Plan? When Would You Use It? How Would You View The Execution Plan?
    Answer :

    The Query Analyzer has a feature called Show Execution Plan. This option allows you to view the execution plan used by SQL Server’s Query Optimizer to actually execute the query. This option is available from the Query menu on the main menu of Query Analyzer, and must be turned on before the query is executed. Once the query is executed, the results of the execution plan are displayed in graphical format in a separate window, available from a tab that appears below the query results window on the screen.

  • Question: What Is De-normalization? When Do You Do It And How?
    Answer :

    De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It’s used To introduce redundancy into a table in order to incorporate data from a related table. The related table can then be eliminated. De-normalization can improve efficiency and performance by reducing complexity in a data warehouse schema.

  • Question: What Is Indexing?
    Answer :

    If we give proper indexes on a table so that any queries written against this table can run efficiently. As your data sets grow over time, SQL Server will continue to rebuild indexes and move data around as efficiently as possible. This property is known as Indexing.

  • Question: What Is Referential Integrity And How Can We Achieve It?
    Answer :

    Referential integrity preserves the defined relationships between tables when records are entered or deleted. In SQL Server, referential integrity is based on relationships between foreign keys and primary keys or between foreign keys and unique keys. Referential integrity ensures that key values are consistent across tables. Such consistency requires that there be no references to nonexistent values and that if a key value changes, all references to it change consistently throughout the database. We can achieve this by using foreign key.

  • Question: What Is State?
    Answer :

    It is the property of the web forms.

    ASP.NET provides four types of state:

    1. Application state
    2. Session state
    3. Cookie state
    4. View state.
  • Question: What Is Task?
    Answer :

    Whenever you execute a program, the operating system creates a new task for it. The task is like an envelope for the program. It identifies the program with a task number and attaches other bookkeeping information to it.

  • Question: What Is The Maximum Length Of A Varchar In Sql Server?
    Answer :

    8000

  • Question: What Is The Purpose Of Update Statistics?
    Answer :

    UPDATE STATISTICS– it updates information about the distribution of key values for one or more statistics groups (collections) in the specified table or indexed view.

  • Question: What Is The Purpose Of Using Collate In A Query?
    Answer :

    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 case-sensitivity, accent marks, kana character types and character width.

  • Question: What Is The Stuff Function And How Does It Differ From The Replace Function?
    Answer :

    STUFF – It deletes a specified length of characters and inserts another set of characters at a specified starting point.

    REPLACE – Replaces all occurrences of a specified string value with another string value.

  • Question: What Is The Use Of Trace Utility?
    Answer :

    Tracing is a very important monitoring and debugging tool for distributed, multitier applications. Such applications often contain problems that can only be observed when the application is under a heavy load and the inherent randomness of a real-life environment. Trace utility allows developers and administrators to monitor the health of applications running in real-life settings.

  • Question: Which Dll File Is Needed To Be Registered For Asp?
    Answer :

    The dll needed for the ASP.net is SYSTEM.WEB.dll

  • Question:Name Atleast Two Methods Of Response Object Other Than Transfer?
    Answer :

    a) Response.ClearContent( ):

    Clears the content of the current output stream.

    b) Response.ClearHeaders( ):

    Clears the HTTP headers from the current output stream.

  • 100+ TOP ASP.NET MVC Interview Questions and Answers [UPDATED]

    If you’re preparing for ASP.NET MVC job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in ASP.NET MVC interview, then go through the below 100+ Top ASP.NET MVC Interview Questions and Answers to crack your job interview.

    ASP.NET MVC Interview Questions and Answers

  • Question: Breifly Explain Us What Is Asp.net Mvc?
    Answer :

    ASP.Net MVC is a pattern which is used to split the application’s implementation logic into three components i.e. models, views, and controllers.

  • Question: Can A View Be Shared Across Multiple Controllers? If Yes, How We Can Do That?
    Answer :

    Yes we can share a view across multiple controllers. We can put the view in the “Shared” folder. When we create a new ASP.Net MVC Project we can see the Layout page will be added in the shared folder, which is because it is used by multiple child pages.

  • Question: Can I Add Asp.net Mvc Testcases In Visual Studio Express?
    Answer :

    No. We cannot add the test cases in Visual Studio Express edition it can be added only in Professional and Ultimate versions of Visual Studio.

  • Question: Can I Set The Unlimited Length For “maxjsonlength” Property In Config?
    Answer :

    No. We can’t set unlimited length for property maxJsonLength. Default value is – 102400 and maximum value what we can set would be : 2147483644.

  • Question: Can I Use Razor Code In Javascript In Asp.net Mvc?
    Answer :

    Yes. We can use the razor code in javascript in cshtml by using element.

    @foreach (var item in Model) {

    //javascript goes here which uses the server values

    }

  • Question: Can We Add Constraints To The Route? If Yes, Explain How We Can Do It?
    Answer :

    Yes we can add constraints to route in following ways :

    • Using Regular Expressions
    • Using object which implements interface – IRouteConstraint.
  • Question: Can You Explain Renderbody And Renderpage In Asp.net Mvc?
    Answer :

    RenderBody is like ContentPlaceHolder in web forms. This will exist in layout page and it will render the child pages/views. Layout page will have only one RenderBody() method. RenderPage also exists in Layout page and multiple RenderPage() can be there in Layout page.

  • Question: Do You Know About The New Features In Asp.net Mvc 4 (asp.net Mvc4)?
    Answer :

    Following are features added newly : Mobile templates Added ASP.NET Web API template for creating REST based services. Asynchronous controller task support. Bundling of the java scripts. Segregating the configs for ASP.Net MVC routing, Web API, Bundle etc.

  • Question: Does Tempdata Hold The Data For Other Request In Asp.net Mvc?
    Answer :

    If Tempdata is assigned in the current request then it will be available for the current request and the subsequent request and it depends whether data in TempData read or not. If data in Tempdata is read then it would not be available for the subsequent requests.

  • Question: Explain Bundle.config In Asp.net Mvc4?
    Answer :

    “BundleConfig.cs” in ASP.Net MVC4 is used to register the bundles by the bundling and minification system. Many bundles are added by default including jQuery libraries like – jquery.validate, Modernizr, and default CSS references.

  • Question: Explain Dependency Resolution?
    Answer :

    Dependency Resolver again has been introduced in ASP.Net MVC3 and it is greatly simplified the use of dependency injection in your applications. This turn to be easier and useful for decoupling the application components and making them easier to test and more configurable.

  • Question: Explain Json Binding?
    Answer :

    JavaScript Object Notation (JSON) binding support started from ASP.Net MVC3 onwards via the new JsonValueProviderFactory, which allows the action methods to accept and model-bind data in JSON format. This is useful in Ajax scenarios like client templates and data binding that need to post data back to the server.

  • Question: Explain Keep Method In Tempdata In Asp.net Mvc?
    Answer :

    As explained above in case data in Tempdata has been read in current request only then “Keep” method has been used to make it available for the subsequent request.

    @TempData[“TestData”];

    TempData.Keep(“TestData”);

  • Question: Explain Peek Method In Tempdata In Asp.net Mvc?
    Answer :

    Similar to Keep method we have one more method called “Peek” which is used for the same purpose. This method used to read data in Tempdata and it maintains the data for subsequent request.

    string A4str = TempData.Peek(“TT”).ToString();

  • Question: Explain Sections Is Asp.net Mvc?
    Answer :

    Section are the part of HTML which is to be rendered in layout page. In Layout page we will use the below syntax for rendering the HTML :

    @RenderSection(“TestSection”) And in child pages we are defining these sections as shown below :

    @section TestSection{

    Test Content

    } If any child page does not have this section defined then error will be thrown so to avoid that we can render the HTML like this :

    @RenderSection(“TestSection”, required: false)

  • Question: Explain Tempdata In Asp.net Mvc?
    Answer :

    TempData is again a key, value pair as ViewData. This is derived from “TempDataDictionary” class. TempData is used when the data is to be used in two consecutive requests, this could be between the actions or between the controllers. This requires typecasting in view.

  • Question: Explain Test Driven Development (tdd) ?
    Answer :

    TDD is a methodology which says, write your tests first before you write your code. In TDD, tests drive your application design and development cycles. You do not do the check-in of your code into source control until all of your unit tests pass.

  • Question: Explain The Advantages Of Asp.net Mvc Over Asp.net?
    Answer :

    • Provides a clean separation of concerns among UI (Presentation layer), model (Transfer objects/Domain Objects/Entities) and Business Logic (Controller).
    • Easy to UNIT Test.
    • Improved reusability of model and views. We can have multiple views which can point to the same model and vice versa.
    • Improved structuring of the code.
  • Question: Explain The Advantages Of Dependency Injection (di) In Asp.net Mvc?
    Answer :

    Below are the advantages of DI :

    • Reduces class coupling
    • Increases code reusing
    • Improves code maintainability
    • Improves application testing
  • Question: Explain The Methods Used To Render The Views In Asp.net Mvc?
    Answer :

    Below are the methods used to render the views from action –

    View() : To return the view from action.

    PartialView() : To return the partial view from action.

    RedirectToAction() : To Redirect to different action which can be in same controller or in different controller.

    Redirect() : Similar to “Response.Redirect()” in webforms, used to redirect to specified URL.

    RedirectToRoute() : Redirect to action from the specified URL but URL in the route table has been matched.

  • Question: Explain The Tools Used For Unit Testing In Asp.net Mvc?
    Answer :

    Below are the tools used for unit testing :

    • NUnit
    • xUnit.NET
    • Ninject 2
    • Moq
  • Question: Explain The Types Of Scaffoldings?
    Answer :

    Below are the types of scaffoldings :

    • Empty
    • Create
    • Delete
    • Details
    • Edit
    • List
  • Question: How Can I Return String Result From Action In Asp.net Mvc?
    Answer :

    Below is the code snippet to return string from action method :

    public ActionResult TestAction() {

    return Content(“Hello Test !!”);

    }

  • Question: How Can We Determine Action Invoked From Http Get Or Http Post?
    Answer :

    This can be done in following way : Use class : “HttpRequestBase” and use the method : “HttpMethod” to determine the action request type.

  • Question: How Does The ‘page Lifecycle’ Of Asp.net Mvc Works?
    Answer :

    Below are the processed followed in the sequence :

    • App initializWhat is Separation of Concerns in ASP.NET ASP.Net MVCation
    • Routing
    • Instantiate and execute controller
    • Locate and invoke controller action
    • Instantiate and render view.
  • Question: How Route Table Has Been Created In Asp.net Asp.net Mvc?
    Answer :

    Method : “RegisterRoutes()” is used for registering the routes which will be added in “Application_Start()” method of global.asax file, which is fired when the application is loaded or started.

  • Question: How To Change The Action Name In Asp.net Mvc?
    Answer :

    “ActionName” attribute can be used for changing the action name.

    Below is the sample code snippet to demonstrate more :

    [ActionName(“TestActionNew”)]

    public ActionResult TestAction()

    {

    return View();

    }

    So in the above code snippet “TestAction” is the original action name and in “ActionName” attribute, name – “TestActionNew” is given. So the caller of this action method will use the name “TestActionNew” to call this action.

  • Question: How To Enable Attribute Routing?
    Answer :

    Just add @Model.CustomerName the method : “MapASP.Net MVCAttributeRoutes()” to enable attribute routing as shown below:

    public static void RegisterRoutes(RouteCollection routes)

    {

    routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);

    //enabling attribute routing

    routes.MapASP.Net MVCAttributeRoutes();

    //convention-based routing

    routes.MapRoute

    (

    name: “Default”,

    url: “{controller}/{action}/{id}”,

    defaults: new { controller = “Customer”, action = “GetCustomerList”, id = UrlParameter.Optional }

    );

    }

  • Question: How To Make Sure Client Validation Is Enabled In Asp.net Mvc?
    Answer :

    In Web.Config there are tags called : “ClientValidationEnabled” and “UnobtrusiveJavaScriptEnabled”. We can set the client side validation just by setting these two tags “true”, then this setting will be applied at the application level.

  • Question: How To Return The Json From Action Method In Asp.net Mvc?
    Answer :

    Below is the code snippet to return string from action method :

    public ActionResult TestAction() {

    return JSON(new { prop1 = “Test1”, prop2 = “Test2” });

    }

  • Question: How To Use Jquery Plugins In Asp.net Mvc Validation?
    Answer :

    We can use dataannotations for validation in ASP.Net MVC. If we want to use validation during runtime using Jquery then we can use Jquery plugins for validation.

    Eg:

    If validation is to be done on customer name textbox then we can do as :

    $(‘#CustomerName’).rules(“add”, {

    required: true,

    minlength: 2,

    messages: {

    required: “Please enter name”,

    minlength: “Minimum length is 2”

    }

    });

  • Question: How We Can Add The Css In Asp.net Mvc?
    Answer :

    Below is the sample code snippet to add css to razor views :

  • Question: How We Can Call A Javascript Function On The Change Of A Dropdown List In Asp.net Mvc?
    Answer :

    Create a JavaScript method:

    function DrpIndexChanged() { } Invoke the method:

    x.SelectedProduct, new SelectList(Model.Customers, “Value”, “Text”), “Please Select a Customer”, new { id = “ddlCustomers”, onchange=” DrpIndexChanged ()” })%>

  • Question: How We Can Handle The Exception At Controller Level In Asp.net Mvc?
    Answer :

    Exception Handling is made simple in ASP.Net MVC and it can be done by just overriding “OnException” and set the result property of the filtercontext object (as shown below) to the view detail, which is to be returned in case of exception.

    protected overrides void OnException(ExceptionContext filterContext)

    {

    }

  • Question: How We Can Invoke Child Actions In Asp.net Mvc?
    Answer :

    “ChildActionOnly” attribute is decorated over action methods to indicate that action method is a child action. Below is the code snippet used to denote the child action :

    [ChildActionOnly]

    public ActionResult MenuBar()

    {

    //Logic here

    return PartialView();

    }

  • Question: How We Can Multiple Submit Buttons In Asp.net Mvc?
    Answer :

    Below is the scenario and the solution to solve multiple submit buttons issue. Scenario :

    @using (Html.BeginForm(“MyTestAction”,”MyTestController”)

    {

    } Solution :

    Public ActionResult MyTestAction(string submit) //submit will have value either “MySave” or “MyEdit”

    {

    // Write code here

    }

  • Question: How We Can Register The Area In Asp.net Mvc?
    Answer :

    When we have created an area make sure this will be registered in “Application_Start” event in Global.asax.

    Below is the code snippet where area registration is done :

    protected void Application_Start()

    {

    AreaRegistration.RegisterAllAreas();

    }

  • Question: In Server How To Check Whether Model Has Error Or Not In Asp.net Mvc?
    Answer :

    This can be done in following way : Use class : “HttpRequestBase” and use the method : “HttpMethod” to determine the action request type.

  • Question: Mention Some Action Filters Which Are Used Regularly In Asp.net Mvc?
    Answer :

    Below are some action filters used :

    • Authentication
    • Authorization
    • HandleError
    • OutputCache
  • Question: Tell Us Something About Model, View And Controllers In Asp.net Mvc?
    Answer :

    Model : It is basically a business entity which is used to represent the application data.

    Controller : The Request which is sent by the user always scatters through controller and it’s responsibility is to redirect to the specific view using View () method.

    View : it’s the presentation layer of ASP.Net MVC.

  • Question: What Are Actions In Asp.net Mvc?
    Answer :

    Actions are the methods in Controller class which is responsible for returning the view or json data. Action will mainly have return type : “ActionResult” and it will be invoked from method : “InvokeAction()” called by controller.

  • Question: What Are Ajax Helpers In Asp.net Mvc?
    Answer :

    AJAX Helpers are used to create AJAX enabled elements like as Ajax enabled forms and links which performs the request asynchronously and these are extension methods of AJAXHelper class which exists in namespace – System.Web.ASP.Net MVC.

  • Question: What Are Child Actions In Asp.net Mvc?
    Answer :

    To create reusable widgets child actions are used and this will be embedded into the parent views. In ASP.Net MVC Partial views are used to have reusability in the application. Child action mainly returns the partial views.

  • Question: What Are Code Blocks In Views?
    Answer :

    Unlike code expressions that are evaluated and sent to the response, it is the blocks of code that are executed. This is useful for declaring variables which we may be required to be used later.

    @{

    int x = 123;

    string y = “aa”;

    }

  • Question: What Are Html Helpers In Asp.net Mvc?
    Answer :

    HTML Helpers are like controls in traditional web forms. But HTML helpers are more lightweight compared to web controls as it does not hold viewstate and events. HTML Helpers returns the HTML string which can be directly rendered to HTML page. Custom HTML Helpers also can be created by overriding “HtmlHelper” class.

  • Question: What Are Model Binders In Asp.net Mvc?
    Answer :

    For Model Binding we will use class called : “ModelBinders”, which gives access to all the model binders in an application. We can create a custom model binders by inheriting “IModelBinder”.

  • Question: What Are Non Action Methods In Asp.net Mvc?
    Answer :

    In ASP.Net MVC all public methods have been treated as Actions. So if you are creating a method and if you do not want to use it as an action method then the method has to be decorated with “NonAction” attribute as shown below :

    [NonAction]

    public void TestMethod()

    {

    // Method logic

    }

  • Question: What Are Scaffold Templates In Asp.net Mvc?
    Answer :

    Scaffolding in ASP.NET ASP.Net MVC is used to generate the Controllers,Model and Views for create, read, update, and delete (CRUD) functionality in an application. The scaffolding will be knowing the naming conventions used for models and controllers and views.

  • Question: What Are The Components Required To Create A Route In Asp.net Mvc?
    Answer :

    Name – This is the name of the route.

    URL Pattern : Placeholders will be given to match the request URL pattern.

    Defaults :When loading the application which controller, action to be loaded along with the parameter.

  • Question: What Are The Differences Between Partial View And Display Template And Edit Templates In Asp.net Mvc?
    Answer :

    Display Templates : These are model centric. Meaning it depends on the properties of the view model used. It uses convention that will only display like divs or labels.

    Edit Templates : These are also model centric but will have editable controls like Textboxes.

    Partial View : These are view centric. These will differ from templates by the way they render the properties (Id’s) Eg : CategoryViewModel has Product class property then it will be rendered as Model.Product.ProductName but in case of templates if we CategoryViewModel has List then @Html.DisplayFor(m => m.Products) works and it renders the template for each item of this list.

  • Question: What Are The Options Can Be Configured In Ajax Helpers?
    Answer :

    Below are the options in AJAX helpers :

    Url : This is the request URL.

    Confirm : This is used to specify the message which is to be displayed in confirm box.

    OnBegin : Javascript method name to be given here and this will be called before the AJAX request.

    OnComplete : Javascript method name to be given here and this will be called at the end of AJAX request.

    OnSuccess – Javascript method name to be given here and this will be called when AJAX request is successful.

    OnFailure – Javascript method name to be given here and this will be called when AJAX request is failed.

    UpdateTargetId : Target element which is populated from the action returning HTML.

  • Question: What Are The Possible Razor View Extensions?
    Answer :

    Below are the two types of extensions razor view can have :

    .cshtml : In C# programming language this extension will be used.

    .vbhtml – In VB programming language this extension will be used.

  • Question: What Are The Sub Types Of Actionresult?
    Answer :

    ActionResult is used to represent the action method result. Below are the subtypes of ActionResult :

    • ViewResult
    • PartialViewResult
    • RedirectToRouteResult
    • RedirectResult
    • JavascriptResult
    • JSONResult
    • FileResult
    • HTTPStatusCodeResult
  • Question: What Are Validation Annotations?
    Answer :

    Data annotations are attributes which can be found in the “System.ComponentModel.DataAnnotations” namespace. These attributes will be used for server-side validation and client-side validation is also supported. Four attributes – Required, String Length, Regular Expression and Range are used to cover the common validation scenarios.

  • Question: What Is Area In Asp.net Mvc?
    Answer :

    Area is used to store the details of the modules of our project. This is really helpful for big applications, where controllers, views and models are all in main controller, view and model folders and it is very difficult to manage.

  • Question: What Is Attribute Routing In Asp.net Mvc?
    Answer :

    ASP.NET Web API supports this type routing. This is introduced in ASP.Net MVC5. In this type of routing, attributes are being used to define the routes. This type of routing gives more control over classic URI Routing.

    Attribute Routing can be defined at controller level or at Action level like :

    [Route(“{action = TestCategoryList}”)] – Controller Level

    [Route(“customers/{TestCategoryId:int:min(10)}”)] – Action Level

  • Question: What Is Dependency Injection In Asp.net Mvc?
    Answer :

    it’s a design pattern and is used for developing loosely couple code. This is greatly used in the software projects. This will reduce the coding in case of changes on project design so this is vastly used.

  • Question: What Is Html.renderpartial?
    Answer :

    Result of the method : “RenderPartial” is directly written to the HTML response. This method does not return anything (void). This method also does not depend on action methods. RenderPartial() method calls “Write()” internally and we have to make sure that “RenderPartial” method is enclosed in the bracket. Below is the sample code snippet : @{Html.RenderPartial(“TestPartialView”); }

  • Question: What Is Layout In Asp.net Mvc?
    Answer :

    Layout pages are similar to master pages in traditional web forms. This is used to set the common look across multiple pages. In each child page we can find : /p>

    @{

    Layout = “~/Views/Shared/TestLayout1.cshtml”;

    } This indicates child page uses TestLayout page as it’s master page.

  • Question: What Is Partialview In Asp.net Mvc?
    Answer :

    PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since it’s been shared with multiple views these are kept in shared folder.

    Partial Views can be rendered in following ways :

    • Html.Partial()
    • Html.RenderPartial()
  • Question: What Is Razor View Engine?
    Answer :

    Razor is the first major update to render HTML in ASP.Net MVC 3. Razor was designed specifically for view engine syntax. Main focus of this would be to simplify and code-focused templating for HTML generation.

    Below is the sample of using Razor:

    @model ASP.Net MVCMusicStore.Models.Customer

    @{ViewBag.Title = “Get Customers”;}

    @Model.CustomerName

  • Question: What Is Representational State Transfer (rest) Mean?
    Answer :

    REST is an architectural style which uses HTTP protocol methods like GET, POST, PUT, and DELETE to access the data. ASP.Net MVC works in this style. In ASP.Net MVC 4 there is a support for Web API which uses to build the service using HTTP verbs.

  • Question: What Is Routeconfig.cs In Asp.net Mvc 4?
    Answer :

    “RouteConfig.cs” holds the routing configuration for ASP.Net MVC. RouteConfig will be initialized on Application_Start event registered in Global.asax.

  • Question: What Is Separation Of Concerns In Asp.net Asp.net Mvc?
    Answer :

    It is the process of breaking the program into various distinct features which overlaps in functionality as little as possible. ASP.Net MVC pattern concerns on separating the content from presentation and data-processing from content.

  • Question: What Is The “helper Page.isajax” Property?
    Answer :

    The Helper Page.IsAjax property gets a value that indicates whether Ajax is being used during the request of the Web page.

  • Question: What Is The Difference Between Viewbag And Viewdata In Asp.net Mvc?
    Answer :

    ViewBag is a wrapper around ViewData, which allows to create dynamic properties. Advantage of viewbag over viewdata will be : In ViewBag no need to typecast the objects as in ViewData. ViewBag will take advantage of dynamic keyword which is introduced in version 4.0. But before using ViewBag we have to keep in mind that ViewBag is slower than ViewData.

  • Question: What Is The Meaning Of Unobtrusive Javascript? Explain Us By Any Practical Example?
    Answer :

    This is a general term that conveys a general philosophy, similar to the term REST (Representational State Transfer). Unobtrusive JavaScript doesn’t inter mix JavaScript code in your page markup. Eg : Instead of using events like onclick and onsubmit, the unobtrusive JavaScript attaches to elements by their ID or class based on the HTML5 data- attributes.

  • Question: What Is The Need Of Action Filters In Asp.net Mvc?
    Answer :

    Action Filters allow us to execute the code before or after action has been executed. This can be done by decorating the action methods of controls with ASP.Net MVC attributes.

  • Question: What Is The Use .glimpse In Asp.net Mvc?
    Answer :

    Glimpse is an open source tool for debugging the routes in ASP.Net MVC. It is the client side debugger. Glimpse has to be turned on by visiting to local url link – http://localhost:portname//glimpse.axd This is a popular and useful tool for debugging which tracks the speed details, url details etc.

  • Question: What Is The Use Of View Model In Asp.net Mvc?
    Answer :

    View Model is a plain class with properties, which is used to bind it to strongly typed view. View Model can have the validation rules defined for its properties using data annotations.

  • Question: What Is Viewdata?
    Answer :

    Viewdata contains the key, value pairs as dictionary and this is derived from class : “ViewDataDictionary”. In action method we are setting the value for viewdata and in view the value will be fetched by typecasting.

  • Question: What Is Viewstart Page In Asp.net Mvc?
    Answer :

    This page is used to make sure common layout page will be used for multiple views. Code written in this file will be executed first when application is being loaded.

  • Question: What You Mean By Routing In Asp.net Mvc?
    Answer :

    Routing is a pattern matching mechanism of incoming requests to the URL patterns which are registered in route table. Class : “UrlRoutingModule” is used for the same process.

  • Question: Which Are The Important Namespaces Used In Asp.net Mvc?
    Answer :

    Below are the important namespaces used in ASP.Net MVC :

    • System.Web.ASP.Net MVC
    • System.Web.ASP.Net MVC.Ajax
    • System.Web.ASP.Net MVC.Html
    • System.Web.ASP.Net MVC.Async
  • Question: Why To Use “{resource}.axd/{*pathinfo}” In Routing In Asp.net Mvc?
    Answer :

    Using this default route – {resource}.axd/{*pathInfo}, we can prevent the requests for the web resources files like – WebResource.axd or ScriptResource.axd from passing to a controller.

  • Question: Why To Use Html.partial In Asp.net Mvc?
    Answer :

    This method is used to render the specified partial view as an HTML string. This method does not depend on any action methods.

    We can use this like below :

    @Html.Partial(“TestPartialView”)

  • 15+ TOP ASP.NET MVC 4 Interview Questions and Answers [UPDATED]

    If you’re preparing for ASP.NET MVC 4 job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in ASP.NET MVC 4 interview, then go through the below 15+ Top ASP.NET MVC 4 Interview Questions and Answers to crack your job interview.

    ASP.NET MVC 4 Interview Questions and Answers

  • Question: Is Mvc 4 Supporting Windows Azure Sdk (software Development Kit) ?
    Answer :

    Yes, MVC 4 is supporting Windows Azure SDK version 1.6 or higher.

  • Question: What Are Bundling & Minification Features In Asp.net Mvc 4?
    Answer :

    Bundling & Minification reduces number of HTTP requests. Bundling & Minification combines individual files into single. Bundled file for CSS & scripts and then it reduce’s overall size by minifying the contents of the bundle.

  • Question: What Are The Difference Between Asynchronous Controller Implementation B/w Asp.net Mvc 3 & Asp.net Mvc 4? Can You Explain In Detail?
    Answer :

    There is major difference is on implementation mechanism between ASP.NET MVC 3 and ASP.NET MVC 4.

    In ASP.NET MVC 3, to implement async controller or methods we need to derive controller from AsyncController rather than from normal plain Controller class. We need to create 2 action methods rather than one. First with suffix  ‘Async’ keyword & second with ‘Completed’ suffix.

    In  ASP.NET MVC 4 you need not to declare 2 action method. One can serve the purpouse. MVC 4 using .Net Framework 4.5 support for asynchronous communication.

  • Question: What Are The Main Features Of Asp.net Mvc 4 Used By Asp.net Web Api?
    Answer :

    Routing changes: ASP.NET Web API uses same convention for config mapping that ASP.NET MVC provides.

    Model Binding & Validation: ASP.NET Web API uses same model binding functionality, but HTTP specific context related operations only.

    Filters: The ASP.NET Web API uses most of built-in filters from MVC.

    Unit Testing: Now Unit testing based on MVC, strongly unit testable.

  • Question: What Are The New Enhancements Done In Default Project Template Of Asp.net Mvc 4?
    Answer :

    • Adaptive rendering  for Nice Look & Feel
    • Modern Looking for Mobile & Desktop browser

    The new enhanced default project template came up with modern looking. Along with some cosmetic enhancements, it also employs new adaptive rendering to look nice in both desktop and mobile browsers without need of any kind of additional customization.

  • Question: What Is Main Objective Of Asp.net Mvc 4 Or What Is New In Mvc4 ?
    Answer :

    • Easy Mobile web applications (ASP.NET MVC 4 complete focus on Mobile application development)
    • Full HTML5 support
    • ASP.NET MVC web application with cloud support
    • Working with different mobile and desktop web browsers
    • Description.
    • The main objective of ASP.NET MVC 4 is making to develop mobile web applications easily.Other than mobile web applications It’s focus is also on better HTML5 support and making ASP.NET MVC web application cloud ready.
    • By using new features of ASP.NET MVC 4 you can develop web applications that can work well across different desktop web browsers and mobile devices.
  • Question: What Is The Use Of Display Modes?
    Answer :

    View can be changed automatically based on browser(For mobile and desktop browser’s)

    Display Modes is newly added feature in ASP.NET MVC 4. Views selected automatically by application depending on the browser. Example: If a desktop browser requests login page of an application it will return ViewsAccountLogin.cshtml view & if a mobile browser requests home page it will return ViewsAccountLogin.mobile.cshtml view.

  • Question: What Is The Use Of Web Api ? Why Web Api Needed, If You Have Already Restful Services Using Wcf ?
    Answer :

    Yes, we can still develop the RESTful services with WCF, but there are two main reasons that prompt users to use Web API instead of RESTful services.

    ASP.NET Web API is included in ASP.NET MVC which obviously increases TDD (Test Data Driven) approach in the development of RESTful services.

    For developing RESTful services in WCF you still needs lot of config settings, URI templates, contract’s & endpoints which developing RESTful services using web API is simple.

  • Question: What Is Web Api ‘s In Asp.net Mvc 4 ?
    Answer :

    • Web API is a new framework for consuming & building HTTP Services.
    • Web API supports wide range of clients including different browsers and mobile devices.
    • It is very good platform for developing RESTful services since it talk’s about HTTP.
  • Question: Why We Need A Separate Mobile Project Template, While We Can Render Our Web Application In Mobile (what’s New In Mvc 4 Mobile Template) ?
    Answer :

    Smart Phones & tablets touch got smart by using new jQuery.Mobile.MVC NuGet pacage.

    The mobile project template touch optimized UI by using jQuery.Mobile.MVC NuGet Package for tablets and smart phones.

  • 15+ TOP Advanced .NET Interview Questions and Answers [UPDATED]

    Read Advanced .NET INTERVIEW QUESTIONS and ANSWERS for experienced freshers PDF download. 15+ Most asked interview questions and answers on Advanced .NET read now.

    List of Advanced .NET Interview Questions and Answers PDF:-

  • Question: What Is Garbage Collection?

    Answer :

    Garbage collection is a heap-management strategy where a run-time component takes responsibility for managing the lifetime of the memory used by objects. This concept is not new to .NET – Java and many other languages/runtimes have used garbage collection for some time.

  • Question: What Is The Managed And Unmanaged Code In .net?

    Answer :

    The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime’s functionality and enable you to write code that benefits from this managed execution environment. Code that you develop with a language compiler that targets the runtime is called managed code; it benefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.

  • Question: How Many Languages .net Is Supporting Now?

    Answer :

    When .NET was introduced it came with several languages.
    VB.NET, C#, COBOL and Perl, etc.

  • Question: What Is An Assembly?

    Answer :

    An assembly is the primary building block of .NET Framework applications. In .NET, every application is compiled into an assembly, which refers to a portable  executable (PE) file. The PE file can be either a dynamic Link library of an executable (.exe file).that contains the MSIL code of the compiled application. In addition to the MS11, an assembly also contains the files and resources necessary for the application, assembly metadata, and’ type metadata. An assembly stores the information about itself  such as the name, version number of the assembly, and security information, which Is called metadata. Ibis also o ceded the assembly metadata. The type metadata is the information about the types (classes, structures, interfaces, and enumerations) required for the assembly.

  • Question: What Is Code Access Security (cas)?

    Answer :

    Code access security (CAS) is part of the .NET security model that prevents unauthorized access of resources and operations, and restricts the code to perform particular tasks.

  • Question: What Is Portable Executable (pe)?

    Answer :

    The file format used for executable programs and for files to be linked together to form executable programs

  • Question: What Is Code Access Security?

    Answer :

    Code access security (CAS) is part of the .NET security mode that determines whether or not a piece of code is allowed to run and what resources it can use while running.

  • Question: What Is Managed Code?

    Answer :

    Managed code is the code that Is executed directly by the CLR. The applications created by using managed code automatically have CLR services such as type Checking, security, and automatic garbage collection. These services Help provide platform and language independence for managed code applications. The CLR compiles the source code to MSIL, not machine code. This MSIL along with the metadata that describes the attributes, classes and methods of the code resides an assembly.

  • Question: What Is .net?

    Answer :

    NET is an integral part of many applications running on Windows and provides common functionality for those applications to run. This download is for people who need .NET to run an application on their computer. For developers, the .NET Framework provides a comprehensive and consistent programming model for building applications that have visually stunning user experiences and seamless and secure communication.

  • Question: Differences Between Dataset.clone And Dataset.copy?

    Answer :

    • Clone – Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.
    • Copy – Copies both the structure and data for this DataSet.
  • Question: What Is Serialization?

    Answer :

    Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process, i.e. creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).

  • Question: How To Manage Pagination In A Page Using .net?

    Answer :

    Using pagination option in DataGrid control is available in .NET. We have to set the number of records for a page, then it takes care of pagination by itself automatically.

  • Advanced .NET Questions and Answers for Interview

    Preparing for Advanced .NET job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in Advanced .NET interview, then go through the above 15+ Top Advanced .NET Interview Questions and Answers to crack your job interview.

    50+ TOP ADO.NET Interview Questions and Answers [UPDATED]

    Read ADO.NET INTERVIEW QUESTIONS and ANSWERS for experienced freshers PDF download. 50+ Most asked interview questions and answers on ADO.NET read now.

    List of ADO.NET Interview Questions and Answers PDF:-

  • Question: What Are All The Different Methods Under Sql Command?

    Answer :

    There are different methods under SqlCommand and they are:
    Cancel – Cancel the query
    CreateParameter – returns SQL Parameter
    ExecuteNonQuery – Executes and does not return result set
    ExecuteReader – executes and returns data in DataReader
    ExecuteScalar – Executes and returns single value
    ExecuteXmlReader – Executes and return data in XMLDataReader object
    ResetCommandTimeout – Reset Timeout property

  • Question: What Is The Use Of Dataview?

    Answer :

    User-defined view of a table is contained in a DataView. A complete table or a small section of table depending on some criteria can be presented by an object of the DataView class. You can use this class to sort and find data within DataTable.
    The DataView class has the following methods:
    Find() – Finds a row in a DataView by using sort key value.
    FindRows() – Uses the sort key value to match it with the columns of DataRowView objects. It returns an array of all the corresponding objects of DataRowView whose columns match with the sort key value.
    AddNew() – Adds a new row to the DataView object.
    Delete() – Deletes the specified row from the DataView object according to the specified index.

  • Question: Which Is The Best Method To Get Two Values From The Database?

    Answer :

    ExecuteNonQuery is the best method to get two values from the database.

  • Question: What Is Linq?

    Answer :

    Language Integrated Query or LINQ provides programmers and testers to query data and it uses strongly type’s queries and results.

  • Question: How Can You Identify Whether Or Not Any Changes Are Made To The Dataset Object Since It Was Last Loaded?

    Answer :

    The DataSet object provides the following two methods to track down the changes: 
    The GetChanges() method – Returns the DataSet object, which is changed since it was loaded or since the AcceptChanges() method was executed.
    The HasChanges() method – Indicates if any changes occurred since the DataSet object was loaded or after a call to the AcceptChanges() method was made.
    If you want to revert all changes since the DataSet object was loaded, use the RejectChanges() method.

  • Question: What Are The Different Execute Methods Of Ado.net?

    Answer :

    Following are different execute methods of ADO.Net command object:
    ExecuteScalar – Returns single value from the dataset
    ExecutenonQuery – Returns resultset from dataset and it has multiple values
    ExecuteReader – Forwardonly resultset
    ExecuteXMLReader – Build XMLReader object from a SQL Query

  • Question: What Are The Differences Between Oledb And Sqlclient Providers?

    Answer :

    OLEDB provider is used to access any database and provides flexibility of changing the database at any time. SQLClient provider is used to access only SQL Server database but it provides excellent performance than OLEDB provider while connecting with SQL Server database.

  • Question: What Is Partial Class?

    Answer :

    A Partial class is a class that can be split into two or more classes. This means that a class can be physically separated into other parts of the class within the same namespace. All the parts must use the partial keyword. All the other classes should also have the same access modifier. At the compile time, all the partial classes will be treated as a single class. Let us list some advantages of having partial classes.

  • Question: Do We Use Stored Procedure In Ado.net?

    Answer :

    Yes, stored procedures are used in ADO.Net and it can be used for common repetitive functions.

  • Question: What Are All The Different Authentication Techniques Used To Connect To Ms Sql Server?

    Answer :

    SQL Server should authenticate before performing any activity in the database. There are two types of authentication:
    Windows Authentication – Use authentication using Windows domain accounts only.
    SQL Server and Windows Authentication Mode – Authentication provided with the combination of both Windows and SQL Server Authentication.

  • Question: Which Method Is Used To Sort The Data In Ado.net?

    Answer :

    Sort() method of GridViewControl is used to sort the data in a datatable.

  • Question: What Is The Default Time Out For Sql Command.commandtimeout Property?

    Answer :

    The default timeout of Sqlcommand. CommandTimeout property is 30 Seconds.

  • Question: What Property Must Be Set And What Method Must Be Called In Your Code To Bind The Data From Some Data Source To The Repeater Control?

    Answer :

    You must set the DataSource property and call the DataBind() method.Mention the namespace that is used to include .NET Data Provider for SQL server in .NET code.The System.Data.SqlClient namespace.

  • Question: Which Provider Is Used To Connect Ms Access, Oracle, Etc…?

    Answer :

    OLEDB Provider and ODBC Provider are used to connect to MS Access and Oracle. Oracle Data Provider is also used to connect exclusively for oracle database.

  • Question: What Is The Meaning Of Object Pooling?

    Answer :

    Object pooling is a concept of storing a pool (group) of objects in memory that can be reused later as needed. Whenever, a new object is required to create, an object from the pool can be allocated for this request; thereby, minimizing the object creation. A pool can also refer to a group of connections and threads. Pooling, therefore, helps in minimizing the use of system resources, improves system scalability, and performance.

  • Question: What Is Connection Pooling?

    Answer :

    Connection pooling refers to the task of grouping database connections in cache to make them reusable because opening new connections every time to a database is a time-consuming process. Therefore, connection pooling enables you to reuse already existing and active database connections, whenever required, and increasing the performance of your application.
    You can enable or disable connection pooling in your application by setting the pooling property to either true or false in connection string. By default, it is enabled in an application.

  • Question: Which Object Is Used To Add Relationship Between Two Datatables?

    Answer :

    DataRelation object is used to add relationship between two or more datatable objects.

  • Question: How To Stop Running Thread?

    Answer :

    Thread.Abort() function stops the thread execution at any time.

  • Question: Which Properties Are Used To Bind A Datagridview Control?

    Answer :

    The DataSource property and the DataMember property are used to bind a DataGridView control.

  • Question: What Are The Parameters That Control Most Of Connection Pooling Behaviours?

    Answer :

    The parameters that control most of connection pooling behaviors are as follows:

    • Connect Timeout
    • Max Pool Size
    • Min Pool Size
    • Pooling
  • Question: What Is The Difference Between Command And Commandbuilder Object?

    Answer :

    Command is used to execute all kind of queries like DML and DDL. DML is nothing but Insert, Update and Delete. DDL are like Create and drop tables.
    Command Builder object is used to build and execute DML queries like Create and Drop Tables.

  • Question: What Are Typed And Untyped Dataset?

    Answer :

    Typed datasets use explicit names and data types for their members but untyped dataset uses table and columns for their members.

  • Question: What Are The Usages Of The Command Object In Ado.net?

    Answer :

    The following are the usages of the Command object in AD0.NET:
    The Command object in AD0.NET 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 a Transact-SQL statement against the connection and returns the number of rows affected.
      • The ExecuteScalar() method returns a single value from a database query.
      • The ExecuteReader() method returns a result set by using the DataReader object.
  • Question: What Are All The Classes That Are Available In System.data Namespace?

    Answer :

    Following are the classes that are available in System.Data Namespace:

    • Dataset.
    • DataTable.
    • DataColumn.
    • DataRow.
    • DataRelation.
    • Constraint.
  • Question: What Are The Uses Of Stored Procedure?

    Answer :

    Following are uses of Stored Procedure:

    • Improved Performance.
    • Easy to use and maintain.
    • Security.
    • Less time and effort taken to execute.
    • Less Network traffic.
  • Question: What Is The Difference Between The Clone() And Copy() Methods Of The Dataset Class?

    Answer :

    The Clone() method copies only the structure of a DataSet. The copied structure includes all the relation, constraint, and DataTable schemas used by the DataSet. The Clone() method does not copy the data, which is stored in the DataSet. 
    The Copy() method copies the structure as well as the data stored in the DataSet.

  • Question: How Can You Add Or Remove Rows From The Datatable Object Of Dataset?

    Answer :

    The DataRowCollection class defines the collection of rows for the DataTable object in a DataSet. The DataTable class provides the NewRow() method to add a new DataRow to DataTable. The NewRow method creates a new row, which implements the same schema as applied to the DataTable. The following are the methods provided by the DataRowCollection object:
    Add() – Adds a new row to DataRowCollection.
    Remove()– Removes a DataRow object from DataRowCollection.
    RemoveAt() – Removes a row whose location is specified by an index number.

  • Question: What Are All The Commands Used With Data Adapter?

    Answer :

    DataAdapter is used to retrieve data from a data source .Insertcommand, UpdateCommand and DeleteCommand are the commands object used in DataAdapter to manage update on the database.

  • Question: Describe The Disconnected Architecture Of Ado.net’s Data Access Model?

    Answer :

    ADO.NET maintains a disconnected database access model, which means, the application never remains connected constantly to the data source. Any changes and operations done on the data are saved in a local copy (dataset) that acts as a data source. Whenever, the connection to the server is re-established, these changes are sent back to the server, in which these changes are saved in the actual database or data source.

  • Question: What Are The Pre-requisites For Connection Pooling?

    Answer :

    The prerequisites for connection pooling are as follows:

    • There must be multiple processes to share the same connection describing the same parameters and security settings.
    • The connection string must be identical.
  • Question: What Is The Difference Between Oledb Provider And Sqlclient?

    Answer :

    With respect to usage, there is no difference between OLEDB Provider and SqlClient. The difference lies in their performance. SqlClient is explicitly used to connect your application to SQL server directly, OLEDB Provider is generic for various databases, such as Oracle and Access including SQL Server.Therefore, there will be an overhead which leads to performance degradation.

  • Question: What Is A Datareader Object?

    Answer :

    The DataReader object helps in retrieving the data from a database in a forward-only, read-only mode. The base class for all the DataReader objects is the DbDataReader class.
    The DataReader object is returned as a result of calling the ExecuteReader() method of the Command object. The DataReader object enables faster retrieval of data from databases and enhances the performance of .NET applications by providing rapid data access speed. However, it is less preferred as compared to the DataAdapter object because the DataReader object needs an Open connection till it completes reading all the rows of the specified table. 
    An Open connection to read data from large tables consumes most of the system resources. When multiple client applications simultaneously access a database by using the DataReader object, the performance of data retrieval and other related processes is substantially reduced. In such a case, the database might refuse connections to other .NET applications until other clients free the resources.

  • Question: Explain In Brief Dataadapter Class In Ado.net?

    Answer :

    The DataAdapter class retrieves data from the database, stores data in a dataset, and reflects the changes made in the dataset to the database. The DataAdapter class acts as an intermediary for all the communication between the database and the DataSet object. The DataAdapter Class is used to fill a DataTable or DataSet Object with data from the database using the Fill() method. The DataAdapter class applies the changes made in dataset to the database by calling the Update() method. 
    The DataAdapter class provides four properties that represent the database command: 
    SelectCommand, InsertCommand, DeleteCommand, and UpdateCommand.

  • Question: What Is Ado.net?

    Answer :

    ADO.NET is a part of the Microsoft .NET Framework. This framework provides the set of classes that deal with data communication between various layers of the software architecture and the database. It provides a continuous access to different data source types such as SQL Server versions 7, 2000, 2005. It also provides connectivity options to data sources through OLE DB and XML. Connectivity may be established with other databases like Oracle, MySQL etc. as well.
    ADO.NET has the ability to separate data access mechanisms, data manipulation mechanisms and data connectivity mechanisms.
    ADO.NET introduces along with it the disconnected architecture. In a disconnected architecture, data may be stored in a DataSet. It contains providers for connecting to databases, commands for execution and retrieval of results.
    The classes for ADO.NET are stored in the DLL System.Data.dll.

  • Question: What Are The Various Methods Provided By The Dataset Object To Generate Xml?

    Answer :

    The various methods provided by the DataSet object to generate XML are:

    • ReadXml() – Reads XML document into a DataSet object.
    • GetXml() – Returns a string containing an XML document.
    • WriteXml() – Writes an XML data to disk.
  • Question: What Are The Classes In System.data.common Namespace?

    Answer :

    There are two classes involved in System.Data.Common Nameapce:

    • DataColumnMapping.
    • DataTableMapping.
  • Question: What Is The Difference Between Dataset.clone And Dataset.copy?

    Answer :

    Dataset.clone object copies structure of the dataset including schemas, relations and constraints. This will not copy data in the table.
    Dataset.copy – Copies both structure and data from the table.

  • Question: What Is The Role Of The Dataset Object In Ado.net?

    Answer :

    One of the major component of ADO.NET is the DataSet object, which always remains disconnected from the database and reduces the load on the database.

  • Question: What Are The Data Providers In Ado.net?

    Answer :

    Following are the Data Providers used in ADO.Net:.

    • MS SQL Server.
    • OLEDB.
    • ODBC.
  • Question: What Are The Methods Of Xml Dataset Object?

    Answer :

    There are various methods of XML dataset object:
    GetXml() – Get XML data in a Dataset as a single string.
    GetXmlSchema() – Get XSD Schema in a Dataset as a single string.
    ReadXml() – Reads XML data from a file.
    ReadXmlSchema() – Reads XML schema from a file.
    WriteXml() – Writes the contents of Dataset to a file.
    WriteXmlSchema() – Writes XSD Schema into a file.

  • Question: Is It Possible To Load Multiple Tables In A Dataset?

    Answer :

    Yes, it is possible to load multiple tables in a single dataset.

  • Question: How Can We Load Multiple Tables In To Dataset?

    Answer :

    DataSet ds=new DataSet();
    SqlDataAdapter dap=new SqlDataAdapter(Select * from ,);
    dap.Fill(ds,”TableOne”);
    SqlDataAdapter dap1=new SqlDataAdapter(Select * from ,);
    dap1.Fill(ds,”tableTwo”);

  • Question: Explain The Architecture Of Ado.net In Brief.

    Answer :

    AD0.NET consists of two fundamental components:

    • The DataSet, which is disconnected from the data source and does not need to know where the data that it holds is retrieved from.
    • The .net data provider, which allows you to connect your application to the data source and execute the SQL commands against it.

    The data provider contains the Connection, Command, DataReader, and DataAdapter objects.The Connection object provides connectivity to the database. The Command object provides access to database commands to retrieve and manipulate data in a database. The DataReader object retrieves data from the database in the readonly and forward-only mode. The DataAdapter object uses Command objects to execute SQL commands. The DataAdapter object loads the DataSet object with data and also updates changes that you have made to the data in the DataSet object back to the database.

  • Question: What Are All Components Of Ado.net Data Provider?

    Answer :

    Following are the components of ADO.Net Data provider:
    Connection object – Represents connection to the Database
    Command object – Used to execute stored procedure and command on Database
    ExecuteNonQuery – Executes command but doesn’t return any value
    ExecuteScalar – Executes and returns single value
    ExecuteReader – Executes and returns result set
    DataReader – Forward and read only recordset
    DataAdapter – This acts as a bridge between database and a dataset.

  • Question: What Are Different Layers Of Ado.net?

    Answer :

    There are three different layers of ADO.Net:

    • Presentation Layer
    • Business Logic Layer
    • Database Access Layer
  • ADO.NET Questions and Answers for Interview

    Preparing for ADO.NET job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in ADO.NET interview, then go through the above 50+ Top ADO.NET Interview Questions and Answers to crack your job interview.

    25+ Top .NET Assemblies Interview Questions and Answers [UPDATED]

    Read .NET Assemblies INTERVIEW QUESTIONS and ANSWERS for experienced freshers PDF download. 25+ Most asked interview questions and answers on .NET Assemblies read now.

    .NET Assemblies Interview Questions and Answers

    List of .NET Assemblies Interview Questions and Answers PDF:-

    Question: Name The Msil Disassembler Utility That Parses Any .net Framework Assembly And Shows The Information In Human Readable Format?

    Answer :

    The Ildasm.exe utility.

    Question: What Are The Different Types Of Assemblies? Explain Them In Detail?

    Answer :

    The following are the two types of assemblies:

    Private Assembly – Refers to the assembly that is used by a single application. Private assemblies are kept in a local folder in which the client application has been installed.

    Public or Shared Assembly – Refers to the assembly that is allowed to be shared by multiple applications. A shared assembly must reside in Global Assembly Cache (GAC) with a strong name assigned to it.

    For example, imagine that you have created a DLL containing information about your business logic. This DLL can be used by your client application. In order to run the client application, the DLL must be included in the same folder in which the client application has been installed. This makes the assembly private to your application. Now suppose that the DLL needs to be reused in different applications. Therefore, instead of copying the DLL in every client application folder, it can be placed in the global assembly cache using the GAC tool. These assemblies are called shared assemblies.

    Question: What Is Global Assembly Cache?

    Answer :

    Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.

    You should share assemblies by installing them into the global assembly cache only when you need to. As a general guideline, keep assembly dependencies private, and locate assemblies in the application directory unless sharing an assembly is explicitly required. In addition, it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.

    There are several ways to deploy an assembly into the global assembly cache:

    • Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
    • Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the Windows Software Development Kit (SDK).
    • Use Windows Explorer to drag assemblies into the cache.
    • Assemblies deployed in the global assembly cache must have a strong name. When an assembly is added to the global assembly cache, integrity checks are performed on all files that make up the assembly. The cache performs these integrity checks to ensure that an assembly has not been tampered with, for example, when a file has changed but the manifest does not reflect the change.
    Question: What Is The Value Of The Copy Local Property When You Add An Assembly In The Gac?

    Answer :

    False.

    Question: What Is The Significance Of The Strong Name Tool?

    Answer :

    The Strong Name utility (sn.exe) helps in creating unique public-private key pair files that are called strong name files and signing assemblies with them. It also allows key management, signature generation, and signature verification.

    Question: Is Versioning Applicable To Private Assemblies?

    Answer :

    No, versioning is not applicable to private assemblies as these assemblies reside in their individual folders. Versioning can be applied to GAC only.

    Question: What Is An Application Domain?

    Answer :

    A boundary that the common language runtime establishes around objects created within the same application scope. Application domains help isolate objects created in one application from those created in other applications so that run-time behavior is predictable. Multiple application domains can exist in a single process.

    Question: What Is Namespace?

    Answer :

    The namespace keyword is used to declare a scope. This namespace scope lets you organize code and gives you a way to create globally unique types.

    Within a namespace, you can declare one or more of the following types:

    • Another namespace
    • Class
    • Interface
    • Struct
    • Enum
    • Delegate

    Whether or not you explicitly declare a namespace in a C# source file, the compiler adds a default namespace. This unnamed namespace, sometimes referred to as the global namespace, is present in every file. Any identifier in the global namespace is available for use in a named namespace.

    Namespaces implicitly have public access and this is not modifiable.

    It is possible to define a namespace in two or more declarations.e.g: namespace MyCompany.Proj1{ class MyClass { }} namespace MyCompany.Proj1{ class MyClass1 { }}

    Namespaces have the following properties:

    • They organize large code projects.
    • They are delimited by using the . operator.
    • The using directive obviates the requirement to specify the name of the namespace for every class.
    • The global namespace is the “root” namespace: global::System will always refer to the .NET Framework namespace System.
    Question: Discuss The Concept Of Strong Names?

    Answer :

    Whenever, an assembly is deployed in GAC to make it shared, a strong name needs to be assigned to it for its unique identification. A strong name contains an assembly’s complete identity – the assembly name, version number, and culture information of an assembly. A public key and a digital signature, generated over the assembly, are also contained in a strong name. A strong name makes an assembly identical in GAC.

    Question 22. The Assemblyinfo.cs File Stores The Assembly Configuration Information And Other Information, Such As The Assembly Name, Version, Company Name, And Trademark Information. (true/false)?

    Answer :

    True.

    Question: Which Utility Allows You To Reference An Assembly In An Application?

    Answer :

    An assembly can be referenced by using the gacutil.exe utility with the /r option. The /r option requires a reference type, a reference ID, and a description.

    Question: What Is Native Image Generator?

    Answer :

    The Native Image Generator (Ngen.exe) is a tool that creates a native image from an assembly and stores that image to native image cache on the computer. Whenever, an assembly is run, this native image is automatically used to compile the original assembly. In this way, this tool improves the performance of the managed application by loading and executing an assembly faster.

    Note that native images are files that consist of compiled processor-specific machine code. The Ngen.exe tool installs these files on to the local computer.

    Question: What Is A Satellite Assembly?

    Answer :

    Satellite assemblies are assemblies that are used to deploy language and culture specific resources for an application. In an application, a separate product ID is assigned to each language and a satellite assembly is installed in a language specific sub-directory.

    Question: What Is An Assembly?

    Answer :

    Assemblies are the basic building blocks required for any application to function in the .NET realm. They are partially compiled code libraries that form the fundamental unit of deployment, versioning, activation scoping, reuse, and security. Typically, assemblies provide a collection of types and resources that work together to form a logical unit of functionality. They are the smallest deployable units of code in .NET. Compared to the executable files assemblies are far more reliable, more secure, and easy to manage. An assembly contains a lot more than the Microsoft Intermediate Language (MSIL) code that is compiled and run by the Common Language Runtime (CLR). In other words, you can say that an assembly is a set of one or more modules and classes compiled in MSIL, and metadata that describes the assembly itself, as well as the functionalities of the assembly classes.

    Question: What Is The Difference Between .exe And .dll Files?

    Answer :

    EXE:

    • It is an executable file, which can be run independently.
    • EXE is an out-process component, which means that it runs in a separate process.
    • It cannot be reused in an application.
    • It has a main function.

    DLL:

    • It is Dynamic Link Library that is used as a part of EXE or other DLLs. It cannot be run independently.
    • It runs in the application process memory, so it is called as in-process component.
    • It can be reused in an application.
    • It does not have a main function.
    Question: Explain About Using Directive?

    Answer :

    The using directive has two uses:

    • To allow the use of types in a namespace so that you do not have to qualify the use of a type in that namespace
    • To create an alias for a namespace or a type. This is called a using alias directive.

    The scope of a using directive is limited to the file in which it appears. Create a using alias to make it easier to qualify an identifier to a namespace or type.Namespaces come in two categories: user-defined and system-defined. User-defined namespaces are namespaces defined in your code.

    Question: Where Is The Information Regarding The Version Of The Assembly Stored?

    Answer :

    Information for the version of assembly is stored inside the assembly manifest.

    Question: What Is Metadata?

    Answer :

    An assembly metadata describes every data type and member defined in the code. It stores the description of an assembly, such as name, version, culture, public key of an assembly along with the types exported, other assemblies dependent on this assembly, and security permissions needed to run the application. In addition, it stores the description of types, such as the name, visibility, base class, interfaces implemented, and members, such as methods, fields, properties, events, and nested types.

    It also stores attributes. Metadata is stored in binary format. Therefore, metadata of an assembly is sharable among applications that execute on various platforms. It can also be exported to other applications to give information about the services and various features of an application.

    Question: What Is Global Assembly Cache (gac) ?

    Answer :

    GAC is a central repository (cache) in a system in which assemblies are registered to share among various applications that execute on local or remote machines. .NET Framework provides the GAC tool (gacutil.exe utility), which is used to view and change the content of GAC of a system. Adding new assemblies to GAC and removing assemblies from GAC are some of the tasks that can be performed by using the gacutil.exe utility. GAC can contain multiple versions of the same .NET assembly. CLR checks GAC for a requested assembly before using information of configuration files.

    The gacutil.exe /i <assembly name> – is the command that is used to install an assembly in GAC. Users use the Command Prompt of Visual Studio to install an assembly in GAC by using this command.

    You can see all the assemblies installed in the GAC using the GAC viewer, which is located at the <WinDrive>:<WinDir>assembly directory, where <WinDir> is windows in Windows XP or windows in Windows Vista or WinNT in Windows 2000. Apart from the list of assemblies, the assembly viewer also shows relevant information, such as the global assembly name, version, culture, and the public key token.

    Question: How Can Different Versions Of Private Assemblies Be Used In The Same Application Without A Re-build?

    Answer :

    You can use different versions of private assemblies in the same application without a re-build by specifying the assembly version in the AssemblyInfo.cs or AssemblyInfo.vb file.

    Question: Name The Different Components Of An Assembly?

    Answer :

    An assembly is a logical unit that is made up of the following four different types of components:

    • Assembly manifest
    • MSIL source code
    • Type metadata
    • Resources
    Question: What Is Assembly Manifest?

    Answer :

    Assemblies maintain all their information in a special unit called the manifest. Every assembly has a manifest.

    The followings are the contents of an Assembly Manifest:

    Assembly name – Represents a text string that specifies the assembly’s name.

    Version number – Represents a major and minor version number, as well as a revision and build number. The CL.R makes use of these numbers to enforce version policy.

    Culture – Represents information of the culture or language, which the assembly supports. An assembly is a container of only resources containing culture- or language-specific information.

    Strong name information – Represents the public key from the publisher, if a strong name is assigned to an assembly.

    List of all files in the assembly – Represents a hash of each file contained in the assembly and a file name.

    Type reference information – Represents the information used at the runtime to map a type reference to the file that contains its declaration and implementation.

    Information on referenced assemblies – Represents a list of other assemblies that are statically referenced by the assembly. Each reference includes the names of dependent assemblies, assembly metadata (version, culture, operating system, and so on), and public key, if the assembly is strong named.

    .NET Assemblies Questions and Answers for Interview

    If you are preparing for .NET Assemblies job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in .NET Assemblies interview, then go through the above 25+ Top .NET Assemblies Interview Questions and Answers to crack your job interview.

    20+ Top .NET DEPLOYMENT Interview Questions and Answers [UPDATED]

    Read .NET DEPLOYMENT INTERVIEW QUESTIONS and ANSWERS for experienced freshers PDF download. 20+ Most asked interview questions and answers on .NET DEPLOYMENT read now.

    .NET DEPLOYMENT Interview Questions and Answers

    List of .NET DEPLOYMENT Interview Questions and Answers PDF:-

    Question: What Is Deployment?

    Answer :

    Deployment refers to the distribution of an application among various end-users. It is a process that makes software available for use by just installing it on the client computer.

    Question: Can You Deploy An Asp.net Web Application Project Using The Copy Web Site Option?

    Answer :

    No. The Copy Web Site option can only be used to deploy the Web sites.

    Question: What Is The Difference Between Deploying And Publishing An Application?

    Answer :

    In deployment, you can create a new setup and deployment project. In this project, you can add the project output and create a setup.exe file.

    After creating an executable file, you need to login into the server and execute the setup.exe file to install the application.

    On the other hand, in publishing, you need to right-click the application in the Solution Explorer and select Publish to publish the application.

    Then, you specify a location where the application is to be published.

    The users can then install the application from the location where you have published it and run locally even when the computer is offline.

    Question: What Is Application Cache?

    Answer :

    When a ClickOnce application is installed locally or hosted online, it is stored in the ClickOnce application cache of the client computer.

    The ClickOnce application cache is a set of hidden directories placed under the Local Settings directory of the current user’s Documents and Settings folder.

    The application cache contains all the application files, assemblies, configuration files, application and user settings, and data directory.

    In case the ClickOnce applications are hosted online, the size of the ClickOnce application cache gets limited to a specified amount; whereas, the installed applications do not restrict to the cache size limitation.

    The cache storage quota is responsible to determine the size of the application cache.

    Question: What Is Xcopy?

    Answer :

    XCOPY enables you to deploy an application by copying the application directory and all subdirectories to the target computer and then executing the application on the client.

    The application starts executing on the target computer by using its assembly file, which is a self-description file that contains all the information about the application.

    The XCOPY deployment does not make any impact on the target system while configuring the components and registering entries, and is therefore known as zero-impact installation.

    Question: Why Do You Use Windows Installer?

    Answer :

    The Windows Installer deployment technique allows you to deploy Windows-based and Web applications by creating a Windows Installer Package. The installer package has an extension of.msi and it contains the application, any dependent files, registry entries, and the rest. The installer package can then be distributed to various end-users by simply copying it on the target computers

    The end-users can then run the installer package to install the application anywhere in their computers. The installation takes place using the installation wizard; therefore, the users can easily install the application on their system. Once your application is installed on the target computer, end-users can open the application from the installed location.

    Question: What Is The Use Of The Copy Project Command?

    Answer :

    The Copy Project command copies only the files required to run the project and pastes it on the target server. It does not deploy the complete project; therefore, IIS directory settings are not automatically configured.

    Question: How Can You Determine Whether You Should Deploy The Application Or Publish The Application?

    Answer :

    If you want to host the application on a shared hosting environment, you should use publishing; whereas, if you want to create a Web application that is downloaded from a Web site, you should deploy the application to create a setup.exe file.

    Question: What Do You Mean By Merge Module Projects?

    Answer :

    Merge Module projects are used to package the files and components that are shared between multiple applications. The Merge Module project file contains the .msm extension. The .msm file includes files, resources, registry entries, and setup logic. This file is merged with a Windows installer (.msi) file to correctly install the shared files. If a single merge module is used by more than one application, then you need to add that merge module in the package only once.

    Question: What Are The Enhancements In Clickonce Deployment In .net 4.0?

    Answer :

    In .NET 4.0, the ClickOnce deployment technology is enhanced with the following features:

    Support for .NET Framework 4.0 version – Creates applications by using Visual Studio 2010 that can target .NET Framework 4.0 and its new features.
    Support for multiple versions of the .NET Framework – Creates applications that are compatible with multiple versions of the .NET Framework. You can specify the target framework for an application as .NET Framework 3.5 or .NET Framework 4 while creating the application.
    Enhanced logging feature – Stores logging information that includes various parameters passed to the ClickOnce runtime, the browser settings, and ClickOnce security options.
    Custom Installer and User Interface – Allows you to create a custom graphical user interface for installing and updating the .exe applications. In addition, the custom installer can have custom dialog boxes for security and maintenance operations.

    Question: How Can You Deploy An Asp.net Web Application?

    Answer :

    You can deploy an ASP.NET Web application using either the Windows Installer deployment or ClickOnce deployment technique.

    Question: Does Xcopy Copy The Hidden And System Files?

    Answer :

    No. By default, XCOPY excludes the hidden and system files. However, you can include the hidden and system files using the /h switch.

    Question: What Is The Need Of Copy Web Site?

    Answer :

    Copy Web Site is a tool used to deploy the Web site by copying its content files. The Copy Web Site tool also checks whether or not the latest version of a file is present at the destination. If files of the most recent version are found at the destination, then the Copy Web Site tool does not superimpose the older version of files.

    The Copy Web Site deployment tool consists of the following main entities:

    Project source – Specifies the source directory, which contains the contents and references of a Web site at development time. In simple words, you can say that the project source specifies the site that you currently have opened in Visual Studio 2010. The Copy Web Site tool picks all the files for deployment from this location.
    Project destination – Specifies the destination folder where you have to deploy the application. This destination directory can be placed on remote computers or servers, which allow you to copy the Web site contents using the Front Page Server Extensions, FTP, or HTTP protocol implementations for content transfer.
    Synchronizing two Web sites – Synchronizes two Web sites by copying each other’s files. Synchronization checks the files on the local and remote sites and ensures that all files on both sites are up to date.

    Question: Can Windows Applications And The Web Applications Be Deployed Using The Same Template Of Setup And Deployment Project?

    Answer :

    No. the Windows applications use the Setup Project template; whereas, the Web applications use the Web Setup Project template. After the deployment, their installation takes place in the similar way.

    Question: Explain The .net Framework Deployment Features?

    Answer :

    In a general context, .NET Framework includes the following deployment features:

    • No-impact applications – Provides application isolation and removes DLL conflicts.
    • Private components by default – Enables the components to deploy to the application directory and to be visible only to the containing application.
    • Side-by-side versioning – Enables you to select one of the multiple versions.
    • XCOPY deployment and replication – Refers to the self-descriptive application that is deployed without the need to store registry entries.
    • On-the-fly updates – Allows for the updating of the DLLs of the remote computers.
    • Integration with the Microsoft Windows Installer – Makes the features, such as advertising, publishing, repairing, and install-on-demand available during deployment of an application.
    • Enterprise deployment – Eases the task of software distribution.
    • Downloading and caching – Specifies that the downloads are kept smaller and the components are isolated for application use.
    • Partially trusted code – Enables code-based identification.

    Question: List Different Ways Of Deployment That Are Supported By .net Framework 4.0.?

    Answer :

    • Windows Installer
    • ClickOnce
    • XCOPY
    • Copy Web Site
    • Publish Web Site tool

    .NET DEPLOYMENT Questions and Answers for Interview

    If you are preparing for .NET DEPLOYMENT job interview and whether you’re experienced or fresher & don’t know what kind of questions will be asked in .NET DEPLOYMENT interview, then go through the above 20+ Top .NET DEPLOYMENT Interview Questions and Answers to crack your job interview.