Interview Questions.

.Net Interview Questions and Answers

fluid

.Net Interview Questions and Answers

Q1. What is ASP.Net?

Ans: It is a framework evolved by Microsoft on which we can expand new generation internet web sites the usage of web bureaucracy(aspx), MVC, HTML, Javascript, CSS and so on. Its successor of Microsoft Active Server Pages(ASP). Currently there is ASP.NET 4.0, that's used to develop net websites. There are diverse page extensions provided with the aid of Microsoft which can be getting used for internet website online improvement. Eg: aspx, asmx, ascx, ashx, cs, vb, html, XML etc.

Q2. What’s using Response.Output.Write()?

Ans: We can write formatted output  using Response.Output.Write().

Q3. In which event of page cycle is the ViewState available?

Ans: After the Init() and earlier than the Page_Load().

Q4. What is the distinction between Server.Transfer and Response.Redirect?  

Ans: In Server.Transfer web page processing transfers from one web page to the other web page with out creating a round-trip returned to the customer’s browser.  This presents a faster reaction with a touch less overhead on the server.  The clients url records list or cutting-edge url Server does not replace in case of Server.Transfer.

Response.Redirect is used to redirect the person’s browser to any other web page or web site.  It plays trip again to the client where the customer’s browser is redirected to the new web page.  The consumer’s browser history listing is updated to mirror the brand new cope with.

Q5. From which base elegance all Web Forms are inherited?

Ans: Page magnificence. 

Q6. What are the specific validators in ASP.NET?

Ans: Required subject Validator

Range  Validator

Compare Validator

Custom Validator

Regular expression Validator

Summary Validator

Q7. Which validator control you operate in case you want to make sure the values in two specific controls matched?

Ans: Compare Validator manage.

Q8. What is ViewState?

Ans: ViewState is used to preserve the state of server-facet gadgets between web page publish backs.

Q9. Where the viewstate is stored after the web page postback?

Ans: ViewState is stored in a hidden area on the web page at purchaser side.  ViewState is transported to the consumer and back to the server, and isn't always stored on the server or some other outside source.

Q10. How lengthy the gadgets in ViewState exists?

Ans: They exist for the existence of the present day page.

Q11. What are the unique Session country control options to be had in ASP.NET?

Ans:

In-Process

Out-of-Process.

In-Process stores the session in memory at the internet server.

Out-of-Process Session nation control stores information in an external server.  The external server can be both a SQL Server or a State Server.  All items saved in session are required to be serializable for Out-of-Process country control.

Q12. How you may upload an event handler?

Ans: Using the Attributes assets of server facet manage.

     BtnSubmit.Attributes.Add("onMouseOver","JavascriptCode();")
 

Q13. What is caching?

Ans: Caching is a technique used to increase overall performance by maintaining often accessed statistics or documents in reminiscence. The request for a cached report/records could be accessed from cache in preference to real area of that report.

Q14. What are the special types of caching?

Ans: ASP.NET has 3 kinds of caching :

Output Caching,

Fragment Caching,

Data Caching.

Q15. Which kind if caching could be used if we need to cache the part of a web page as opposed to entire web page?

Ans: Fragment Caching: It caches the part of the page generated by means of the request. For that, we can create consumer controls with the underneath code:

     <%@ OutputCache Duration="120" VaryByParam="CategoryID;SelectedID"%>
 

Q16. List the activities in page life cycle.

Ans: 1) Page_PreInit

2) Page_Init

3) Page_InitComplete

four) Page_PreLoad

five) Page_Load

6) Page_LoadComplete

7) Page_PreRender

8)Render

Q17. Can we've a web application strolling without internet.Config document?

Ans: Yes

Q18. Is it viable to create web software with each webforms and mvc?

Ans: Yes. We ought to include under mvc meeting references inside the web bureaucracy software to create hybrid application.

 
 

System.Web.Mvc

System.Web.Razor

System.ComponentModel.DataAnnotations

 

Q19. Can we upload code files of various languages in App_Code folder?

 

Ans: No. The code files have to be in identical language to be saved in App_code folder.

Q20. What is Protected Configuration?

Ans: It is a characteristic used to at ease connection string statistics.

Q21. Write code to send email from an ASP.NET software?

Ans:

 
 

 

 

 

 

 

MailMessage mailMess = new MailMessage ();

mailMess.From = "abc@gmail.Com";

mailMess.To = "xyz@gmail.Com";

mailMess.Subject = "Test e-mail";

mailMess.Body = "Hi This is a take a look at mail.";

SmtpMail.SmtpServer = "localhost";

SmtpMail.Send (mailMess);

 

MailMessage and SmtpMail are instructions defined System.Web.Mail namespace.

Q22. How can we save you browser from caching an ASPX web page?

Ans: We can SetNoStore on HttpCachePolicy object uncovered by means of the Response item’s Cache property:

 
 

Response.Cache.SetNoStore ();

Response.Write (DateTime.Now.ToLongTimeString ());

 

Q23. What is the best practice to put in force validations in aspx web page?

Ans: Client-facet validation is the first-rate manner to validate facts of a web page. It reduces the community traffic and saves server resources.

Q24. What are the event handlers that we are able to have in Global.Asax file?

Ans:

Application Events:Application_Start , Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed,  Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,

Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache

Q25. Which protocol is used to call a Web service?

Ans: HTTP Protocol

Q26. Can we've more than one net config documents for an asp.Internet utility?

Ans: Yes.

Q27. What is the difference between internet config and gadget config?

Ans: Web config record is specific to an internet utility wherein as machine config is unique to a gadget or server. There can be more than one web config files into an application in which as we will have only one machine config document on a server.

Q28. Explain role based security ?

Ans: Role Based Security used to enforce security based totally on roles assigned to user businesses inside the business enterprise.

Then we are able to allow or deny users primarily based on their position inside the business enterprise. Windows defines numerous built-in groups, together with Administrators, Users, and Guests.

 
 

 

 

<AUTHORIZATION>< authorization >

< allow roles="Domain_NameAdministrators" / >   < !-- Allow Administrators in domain. -- >

< deny users="*"  / >                            < !-- Deny anyone else. -- >

< /authorization >

 

Q29. What is Cross Page Posting?

Ans: When we click publish button on an internet web page, the page put up the records to the equal page. The technique wherein we post the statistics to extraordinary pages is called Cross Page posting. This may be performed through setting POSTBACKURL belongings of  the button that causes the postback. Findcontrol method of PreviousPage can be used to get the published values at the web page to which the page has been posted.

Q30. How can we practice Themes to an asp.Internet utility?

Ans: We can specify the subject matter in net.Config document. Below is the code instance to apply topic:

     <configuration>

<system.Web>

<pages theme="Windows7" />

</system.Web>

</configuration>

 

Q31. What is RedirectPermanent in ASP.Net?

Ans: RedirectPermanent Performs a everlasting redirection from the asked URL to the specified URL. Once the redirection is executed, it additionally returns 301 Moved Permanently responses.

Q32. What is MVC?

Ans: vMVC is a framework used to create internet programs. The net utility base builds on  Model-View-Controller pattern which separates the utility good judgment from UI, and the enter and occasions from the consumer might be managed by using the Controller.

Q33. Explain the running of passport authentication.

Ans: First of all it exams passport authentication cookie. If the cookie is not available then the utility redirects the user to Passport Sign on page. Passport provider authenticates the user information on join up web page and if legitimate then shops the authenticated cookie on patron system after which redirect the user to requested page

Q34. What are the advantages of Passport authentication?

Ans: All the websites may be accessed the usage of single login credentials. So no want to do not forget login credentials for every internet web site.

Users can keep his/ her records in a single location.

Q35. What are the asp.Internet Security Controls?

Ans:

<asp:Login>: Provides a widespread login capability that allows the customers to enter their credentials

<asp:LoginName>: Allows you to show the name of the logged-in person

<asp:LoginStatus>: Displays whether the user is authenticated or now not

<asp:LoginView>: Provides numerous login views relying on the chosen template

<asp:PasswordRecovery>:  e-mail the customers their misplaced password

Q36. How do you check in JavaScript for webcontrols ?

Ans: We can sign in javascript for controls using <CONTROL -name>Attribtues.Add(scriptname,scripttext) approach.

Q37. In which occasion are the controls absolutely loaded?

Ans: Page load event.

Q38. What's boxing and unboxing?

Ans: Boxing is assigning a cost kind to reference type variable.

Unboxing is reverse of boxing ie. Assigning reference kind variable to value type variable.

Q39. Differentiate robust typing and susceptible typing

Ans: In robust typing, the statistics forms of variable are checked at bring together time. On the other hand, in case of weak typing the variable records types are checked at runtime. In case of sturdy typing, there is no chance of compilation errors. Scripts use susceptible typing and subsequently problems arises at runtime.

Q40. How we are able to pressure all the validation controls to run?

Ans: The Page.Validate() method is used to force all the validation controls to run and to carry out validation.

Q41. List all templates of the Repeater manipulate.

Ans:

ItemTemplate

AlternatingltemTemplate

SeparatorTemplate

HeaderTemplate

FooterTemplate

Q42. List the fundamental integrated objects in ASP.NET? 

Ans:

Application

Request

Response

Server

Session

Context

Trace

Q43. What is the appSettings Section in the internet.Configfile?

Ans: The appSettings block in web config report sets the consumer-defined values for the entire utility.

For instance, within the following code snippet, the specified ConnectionString phase is used at some stage in the task for database connection:

1

2

3

4

<em><configuration>

<appSettings>

<add key="ConnectionString" value="server=local; pwd=password; database=default" />

</appSettings></em>

 

Q44. Which statistics kind does the RangeValidatorcontrol support?

Ans: The statistics kinds supported via the RangeValidator control are Integer, Double, String, Currency, and Date.

Q45.What is the difference between an Html InputCheckBox manage and an Html Input Radio Button manage?

Ans: In HtmlInputCheckBoxcontrol, multiple object choice is possible whereas in HtmlInputRadioButton controls, we are able to select best single object from the group of objects.

Q46. Which namespaces are necessary to create a localized software?

Ans: System.Globalization

System.Resources

Q47. What are the extraordinary forms of cookies in ASP.NET?

Ans: Session Cookie – Resides at the patron device for a unmarried consultation until the user does no longer sign off.

Persistent Cookie – Resides on a consumer’s device for a period detailed for its expiry, together with 10 days, one month, and never.

Q48. What is the record extension of web provider?

Ans: Web offerings have document extension .Asmx..

Q49. What are the additives of ADO.NET?

Ans: The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection.

Q50. What is the difference between ExecuteScalar and ExecuteNonQuery?

Ans: ExecuteScalar returns output value in which as ExecuteNonQuery does no longer return any value however the quantity of rows stricken by the question. ExecuteScalar used for fetching a single fee and ExecuteNonQuery used to execute Insert and Update statements.

Q51. NET Framework elegance library:

Ans: The .NET framework class library is a collection of reusable sorts and exposes capabilities of the runtime. It includes of a set of training that is used to get admission to common capability.

Q52. What is CTS (Common Type System)?

Ans: The not unusual type system (CTS) defines how types are declared, used, and managed inside the runtime, and is likewise an critical part of the runtime’s assist for go-language integration. The not unusual kind system performs the subsequent capabilities:

Establishes a framework that allows to allow move-language integration, kind protection, and excessive overall performance code execution.

Provides an object-orientated version that helps the whole implementation of many programming languages.

Define the rules that languages should observe, which facilitates to ensure that items written in distinct languages can have interaction with each different.

Q53. What is CLS (Common Language Specification)?

Ans: This is a subset of the CTS which all .NET languages are predicted to support. It turned into usually a dream of Microsoft to unite all extraordinary languages in to one umbrella and CLS is one step towards that. Microsoft has described CLS which can be not anything but pointers that language to follow, in order that it could communicate with other .NET languages in a unbroken way.

Q54. What is .Net Assembly?

Ans: .Net Assembly is one simple constructing of utility. It may be an .Exe or .Dll record.

.Net Assembly may be used to

Simplify application deployment

Solves the versioning problems which could arise with issue-based totally programs

Q55. What are the Different elements in .Net Assembly?

Ans:

Assembly show up

Type Metadata

MSIL Code

Set of Resources

Q56. What is Global Assembly catche?

Ans: If the gadget installs with .NetFramework, then the machine incorporates a machine-extensive code cache called the worldwide meeting cache. The global meeting cache stores assemblies mainly targeted to be shared by means of several applications at the device/computer.

Q57. What are specific methods to set up an assembly in to worldwide assembly catche?

Ans:

We can use the Global Assembly Cache tool (Gacutil.Exe), GAC Tool has furnished through the .NET Framework SDK.

We can use Windows Explorer to pull assemblies into the cache.

We can use an installer designed to paintings with the global meeting cache.

Q58. Explain the Application Domain in .NetFramework?

Ans: Application Domain will isolate applications which are strolling on equal pc. Application domains will offer more relaxed and versatile unit of processing that CLR can use to provide isolation between applications.

Q59. What are the advantages of isolation supplied by means of the Application domains?

Ans:

Faults in a single software cannot affect different applications. The utility domains make certain that code walking in a single domain can't affect other applications in the manner.

Individual packages may be stopped without preventing the complete manner. Application domains will allow you to dump the code strolling in a single application.

Q60. What are the styles of Authentication in ASP.NET?

Ans: There are three sorts of authentication available in ASP.NET:

Windows Authentication: This authentication method makes use of integrated windows safety capabilities to authenticate user.

Forms Authentication: authenticate against a custom designed listing of users or users in a database.

Passport Authentication: validates towards Microsoft Passport carrier which is largely a centralized authentication provider.

Q61. What are Session state modes in ASP.NET?

Ans: ASP.NET supports exceptional consultation state storage options:

In-Processis the default technique. It stores consultation country regionally on same web server reminiscence in which the software is running.

StateServermode stores session state in a procedure other than the one in which application is jogging. Naturally, it has introduced advantages that consultation state is out there from a couple of net servers in a Web Farm and additionally session kingdom will stay preserved even internet utility is restarted.

SQLServermode shops consultation kingdom in SQL Server database. It has the equal benefits as that of StateServer.

Custommodes allows to outline our custom storage issuer.

Offmode disables consultation storage.

Q62. What are the different styles of Validation controls in ASP.NET?

Ans: In order to validate user enter, ASP.NET gives validation server controls. All validation controls inherit from BaseValidator magnificence which contains the common validation homes and strategies like ControlToValidate, Enabled, IsValid, EnableClientScript, ValidationGroup,Validate(), and so on.

ASP.NET gives more than a few validation controls:

RequiredFieldValidator validates compulsory/required enter.

RangeValidator validates the variety. Validates that input falls between the given variety values.

CompareValidator validates or compares the enter of a manipulate with another manipulate value or with a fixed value.

RegularExpressionValidator validates enter price in opposition to a defined regular expression pattern.

CustomValidator lets in to customize the validation common sense with recognize to our application logic.

ValidationSummary presentations all errors on web page together.

Q63. What is the difference among custom controls and person controls?

Ans: Custom controls are basically compiled code, i.E., DLLs. These may be effortlessly delivered to toolbox, so it could be without problems used across more than one projects the usage of drag and drop method. These controls are relatively tough to create.

But User Controls (.Ascx) are similar to pages (.Aspx). These are comparatively smooth to create however tightly coupled with appreciate to User Interface and code. In order to use throughout more than one projects, we want to duplicate and paste to the opposite task as well.




CFG