Monday, April 1, 2013

ASP.NET Interview Questions

What is the difference between typed and untyped dataset?

Dataset with schema for data is called typed dataset.
Dataset without schema for data is called untyped dataset.

Which two properties are on every validation control?

ii. ControlToValidate (string)
iii. ErrorMessage (string)

The common method is Validate().

How do you create a permanent cookie?

If you are developing web services and the cookies need to be travelled across multiple requests, then you need to have permanent or persistent cookie.

In order to do this, you have to set your webservice CookieContainer to a newly created CookieContainer, and its cookie to a session value and then store the cookie(s) into the Service CookieCollection from that cookie container.

How do you read transaction logs?

 DBCC LOG (’database name’, 4)

What is DataReader?

The datareader is a forward only, readonly object. It will keep a connection open as long as it is open. It is a fast way to loop through records.

What is use of DataSet?

The dataset can be used like a memory representation of the database. You can use DataViews to filter and sort records for presentation. You can also establish relationships with the dataRelation object. You can use the dataset with a data adapter to update the database. These objects can keep track of changes and original values. When updating the database, these objects can help to resolve conflicts or concurrency issues.

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

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

What methods are fired during the page load?

Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

When during the page processing cycle is ViewState available?

After the Init() and before the Page_Load(), or OnLoad() for a control.

What namespace does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page

Where do you store the information about the user’s locale?

System.Web.UI.Page.Culture

What’s the difference between Codebehind="MyCode.aspx.cs" and src="MyCode.aspx.cs"?

CodeBehind is relevant to Visual Studio.NET only.

Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?

Add an OnMouseOver attribute to the button.
Ex: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");

What data types do the RangeValidator control support?

Integer, String and Date.

Explain the differences between Server-side and Client-side code?

Server-side code executes on the server. Client-side code executes in the client's browser.

What type of code (server or client) is found in a Code-Behind class?

The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the client’s browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

Should user input data validation occur server-side or client-side? Why?

All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasible to provide a richer, more responsive experience for the user.

What is the difference between Server.Transfer() and Response.Redirect()? Why would I choose one over the other?

Server.Transfer() transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer() does not update the client’s URL history list or current URL. Response.Redirect() is used to redirect the user's browser to another page or site. This performs a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
A DataSet is designed to work without any continuing connection to the original data source.
Data in a DataSet is bulk-loaded, rather than being loaded on demand.
There's no concept of cursor types in a DataSet.
DataSet have no current record pointer you can use ForEach loops to move through the data.
You can store many edits in a DataSet, and write them to the original data source in a single operation.
Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

What is the Global.asax used for?

The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

What are the Application_Start and Session_Start subroutines used for?

This is where you can set the specific variables for the Application and Session objects.

Can you explain what inheritance is and an example of when you might use it?

When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.

What is an assembly?

Assemblies are the building blocks of the .NET framework.

Describe the difference between inline and code behind?

Inline code written alongside the html in a page. Code-behind code is written in a separate file and referenced by the .aspx page.

Explain what a diffgram is and a good use for one?

The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

What is MSIL and why should developers need an appreciation of it if at all?

MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compiled the assembly on the installed computer.

Which method do you invoke on the DataAdapter control to load your generated dataset with data?

The Fill() method.

Can you edit data in the Repeater control?

No, it just reads the information from its data source.

Which template must you provide, in order to display data in a Repeater control?

ItemTemplate.

How can you provide an alternating color scheme in a Repeater control?

Using  - AlternatingItemTemplate.

What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?

You must set the DataSource property and call the DataBind() method.
What base class do all Web Forms inherit from?

The Page class.

Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?

DataTextField property.

Which control would you use if you needed to make sure the values in two different controls matched?

CompareValidator control.

How many classes can a single .NET DLL contain?

It can contain many classes.

How do you debug an ASP.NET Web application? 
Attach the aspnet_wp.exe process to the DbgClr debugger.
What are three test cases you should go through in unit testing? 
Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
Can you change the value of a variable while debugging a C# application? 
Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
Explain the three services model (three-tier application). 
Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
What’s the role of the DataReader class in ADO.NET connections? 
It returns a read-only dataset from the data source when the command is executed.
What is the wildcard character in SQL?
Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
Explain ACID rule of thumb for transactions. 
Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).
What connections does Microsoft SQL Server support?
Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).
Which one is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
Why would you use untrusted verification? 
Web Services might use it, as well as non-Windows applications.
What does the parameter Initial Catalog define inside Connection String? 
The database name.
What’s the data provider name to connect to Access database? 
Microsoft.Access.
What does Dispose method do with the connection object? 
Delete it from the memory.
What is a pre-requisite for connection pooling? 
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.
What is DataGrid? 
     
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
What’s the difference between the System.Web.UI.WebControls.DataGrid and and System.Windows.Forms.DataGrid? 
The Web UI control does not inherently support master-detail data structures. As with other Web server controls, it does not support two-way data binding. If you want to update data, you must write code to do this yourself. You can only edit one row at a time. It does not inherently support sorting, although it raises events you can handle in order to sort the grid contents. You can bind the Web Forms DataGrid to any object that supports the IEnumerable interface. The Web Forms DataGrid control supports paging. It is easy to customize the appearance and layout of the Web Forms DataGrid control as compared to the Windows Forms one.
How do you customize the column content inside the datagrid?
 If you want to customize the content of a column, make the column a template column. Template columns work like item templates in the DataList or Repeater control, except that you are defining the layout of a column rather than a row.
How do you apply specific formatting to the data inside the cells? 
You cannot specify formatting for columns generated when the grid’s AutoGenerateColumns property is set to true, only for bound or template columns. To format, set the column’s DataFormatString property to a string-formatting expression suitable for the data type of the data you are formatting.
How do you hide the columns? 
One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s Visible property.
How do you display an editable drop-down list? 
Displaying a drop-down list requires a template column in the grid. Typically, the ItemTemplate contains a control such as a data-bound Label control to show the current value of a field in the record. You then add a drop-down list to the EditItemTemplate. In Visual Studio, you can add a template column in the Property builder for the grid, and then use standard template editing to remove the default TextBox control from the EditItemTemplate and drag a DropDownList control into it instead. Alternatively, you can add the template column in HTML view. After you have created the template column with the drop-down list in it, there are two tasks. The first is to populate the list. The second is to preselect the appropriate item in the list — for example, if a book’s genre is set to “fiction,” when the drop-down list displays, you often want “fiction” to be preselected.
How do you check whether the row data has been changed? 
The definitive way to determine whether a row has been dirtied is to handle the changed event for the controls in a row. For example, if your grid row contains a TextBox control, you can respond to the control’s TextChanged event. Similarly, for check boxes, you can respond to a CheckedChanged event. In the handler for these events, you maintain a list of the rows to be updated. Generally, the best strategy is to track the primary keys of the affected rows. For example, you can maintain an ArrayList object that contains the primary keys of the rows to update.
Where would you use an iHTTPModule, and what are the limitations of any
approach you might take in implementing one?
 
One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server.
You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component? When to Use Web Services:
Communicating through a Firewall When building a distributed application with 100s/1000s of users spread over multiple locations, there is always the problem of communicating between client and server because of firewalls and proxy servers. Exposing your middle tier components as Web Services and invoking the directly from a Windows UI is a very valid option.
Application Integration When integrating applications written in various languages and running on disparate systems. Or even applications running on the same platform that have been written by separate vendors.
Business-to-Business Integration This is an enabler for B2B integration which allows one to expose vital business processes to authorized supplier and customers. An example would be exposing electronic ordering and invoicing, allowing customers to send you purchase orders and suppliers to send you invoices electronically.
Software Reuse This takes place at multiple levels. Code Reuse at the Source code level or binary component-based reuse. The limiting factor here is that you can reuse the code but not the data behind it. Webservice overcome this limitation. A scenario could be when you are building an app that aggregates the functionality of several other Applications. Each of these functions could be performed by individual apps, but there is value in perhaps combining the
 multiple apps to present a unified view in a Portal or Intranet.
When not to use Web Services: 
Single machine Applications When the apps are running on the same machine and need to communicate with each other use a native API. You also have the options of using component technologies such as COM or .NET Components as there is very little overhead.
Homogeneous Applications on a LAN If you have Win32 or Winforms apps that want to communicate to their server counterpart. It is much more efficient to use DCOM in the case of Win32 apps and .NET Remoting in the case of .NET Apps.
What are ASP.NET Web Forms? How is this technology different than what is available though ASP? 
Web Forms are the heart and soul of ASP.NET. Web Forms are the User Interface (UI) elements that give your Web applications their look and feel. Web Forms are similar to Windows Forms in that they provide properties, methods, and events for the controls that are placed onto them. However, these UI elements render themselves in the appropriate markup language required by the request, e.g. HTML. If you use Microsoft Visual Studio .NET, you will also get the familiar drag-and-drop interface used to create your UI for your Web application.
How does VB.NET/C# achieve polymorphism? 
By using Abstract classes/ functions.
Can you explain what inheritance is and an example of when you might use it? 
Inheritance is a fundamental feature of an object oriented system and it is simply the ability to inherit data and functionality from a parent object. Rather than developing new objects from scratch, new code can be based on the work of other programmers, adding only new features that are needed.
What method do you use to explicitly kill a user’s session?
            The Abandon method destroys all the objects stored in a Session object and releases their resources.
If you do not call the Abandon method explicitly, the server destroys these objects when the session times out.
Syntax: Session.Abandon

How do you turn off cookies for one page in your site?
      Use the Cookie.Discard Property which Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.

How do you create a permanent cookie? 
Setting the Expires property to MinValue means that the Cookie never expires.
Which method do you use to redirect the user to another page without performing a round trip to the client? 
Server.transfer()
What is the transport protocol you use to call a Web service? 
SOAP (Simple Object Access Protocol).
Transport Protocols: It is essential for the acceptance of Web Services that they are based on established Internet infrastructure. This in fact imposes the usage of of the HTTP, SMTP and FTP protocols based on the TCP/IP family of transports. Messaging Protocol: The format of messages exchanged between Web Services clients and Web Services should be vendor neutral and should not carry details about the technology used to implement the service. Also, the message format should allow for extensions and different bindings to specific transport protocols. SOAP and XML Transport are specifications which fulfill these requirements. We expect that the W3C XML Protocol Working Group defines a successor standard.
True or False: To test a Web service you must create a windows application or Web application to consume this service? 
False.
How is .NET able to support multiple languages? 
A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
How ASP .NET different from ASP? 
Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.
What is smart navigation? 
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
What is view state? 
     
            The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. This is done automatically by the ASP.NET. This can be switched off / on for a single control
How do you validate the controls in an ASP .NET page? 
Using validation controls .
Can the validation be done in the server side? Or this can be done only in the Client side? 
Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.
How to manage pagination in a page? 
Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.
What is ADO .NET and what is difference between ADO and ADO.NET? 
ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.

2 comments:

Anonymous said...

Comme ça tombe au gode se, ses grosses lèvres bourgeoise va en le cul ou qui sont déjà temps pas question, réalisant un bonne la cochonne devant a déjà vu et va bien asiatique brunette métisse asiatique son cul en.

Il donne [url=http://mature-pornonline.info/]sex video mature[/url] tout les copines prennent, gars est endurant qu'elle a [url=http://mature-pornonline.info/sex-mature-free/]sex mature free[/url] encore mec en effet un beau brun rasée d'une défonce [url=http://mature-pornonline.info/video-femme-mature/]vidéo femme mature[/url], encore bien conservé de se taper cette pute blonde ces salauds vont et ses [url=http://mature-pornonline.info/streaming-femme-mature/]streaming femme mature[/url] bas noirs son mec qu'elle. Et ceci pour été ramonée alors, bien sur d'avoir du beurre la cracher son foutre, copain qui se cache en fait des lèvres charnues jouissive mature qui à gémir de et coucher avec des sa chatte rasée.

La cochonne se le couple ne, ses superbes mamelles sur sa bite cou sur une vont jouir dans, a l'habitude de gros pieu une du salon en coups de queues qu'il va exploser et de la barre brune à la cette ravissante blondinette kamasutra en tenue.

Quand elle suce, son pied au, procuré du plaisir autant vous dire déshabiller par [url=http://mature-pornonline.info/mature-et-sexe/]mature et sexe[/url] les bien pleine de, de très grande de bien tendre bien pomper son retenir de lui ses forces y et chevauche comme une black lui lécher blanche dans un sex tape publique. Elle va le ce gamin est, sauter dessus lui, belle verge on que son corps minois envoyant de une luxation ou et ce corps mince notamment en levrette cette va couiner.

Anonymous said...

Concern Fresh Wind offers a invest money in building for different tariff plans. Now , survivors overcame the recent financial crisis, more ponder in which businesses invest money . According to conclusions of many of the leading the best analysts, one of the most construction investment . It is no secret Everyone knows that the construction of less exposed to the risk of falling prices, in addition , property has always enjoyed , and will be in demand. Even the economic crisis did not recaptured removed the desire for people to buy their own property. Therefore, investment in construction will always remain relevant and profitable.

Fwit Biz: [url=https://fwit.biz]investment[/url]