Wednesday, 9 May 2012

40 Objective Type ASP.NET Interview Questions (Part 1)

1. How do you retrieve username in case of Windows Authentication?


2. What is the control for which by default post back is true?


3. Where the private assembly is stored in

application / bin directory

4. Where the public assembly is stored in

Global Assembly Cache (GAC)

5. What events will occur when a page is loaded?

1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad

6. Where is the View state data stored?

Hidden Fields

7. What are the different types of sessions in ASP.NET?

InProc, StateServer, SQL Server

8. How do you design a website with multilingual support in ASP.NET?

By using Globalization and Localization

9. What are the different ways of caching in ASP.NET?

There are three ways of caching in ASP.NET:

1) Output Caching - Caches the whole page.
2) Fragment Caching - Caches a part of the page
3) Data Caching - Caches the data

10. How Automatic Memory Management is done is ASP.NET?

By using Garbage Collector

11. How many web.config files can be there in an ASP.NET application?

Atleast one

12. How many navigation controls are there in ASP.NET 4.0?

There are three navigation controls in ASP.NET 4.0:

1) SiteMapPath
2) Menu
3) TreeView

13. List various event which occur throughout the life cycle of a page.

6)Control Events

14. What is boxing and unboxing?

Boxing is what happens when a value-type variable is assigned to a reference-type variable.
Unboxing is what happens when a reference-type variable is assigned to a value-type variable.

15. What are the uses of Reflection?

Reflection is a concept using which we can

1) Load assemblies dynamically
2) Invoke methods at runtime
3) Retriving type information at runtime.

16. What is the lifespan for items stored in ViewState?

The items stored in ViewState live until the lifetime of the current page expires.

17. How can we identify that the Page is Post Back?

By using "IsPostBack" property.

18. In which event of page life cycle are the controls fully loaded?

Page load

19. What is the basic difference between ASP and ASP.NET?

ASP is interpreted whereas ASP.NET is compiled

20. Which is the parent class of the Web server control?

The System.Web.Ul.Control

21. How information about the user's locale can be accessed?

Using System.Web.UI.Page.Culture property

22. How do you sign out from forms authentication?

Using FormsAuthentication.Signout() method

23. What is AutoPostBack?

If you want a control to postback automatically when an event is raised, you need to set the AutoPostBack property of the control to True.

24. Define a Multilingual Website.

A multilingual Web site serves content in a number of languages. It contains multiple copies for its content and other resources, such as date and time, in different languages.

25. What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?

When a browser requests an .aspx file then the server returns a RESPONSE, which is rendered into a HTML string.

26. How can you display all validation messages in one control?

The ValidationSummary control displays all validation messages in one control.

27. Which two new properties are added in ASP.NET 4.0 Page class?

The two new properties added in the Page class are MetaKeyword and MetaDescription.

28. How can you register a custom server control to a Web page?

You can register a custom server control to a Web page using the @Register directive.

29. Which ASP.NET objects encapsulate the state of the client and the browser?

The Session object encapsulates the state of the client and browser.

30. Which method is used to force all the validation controls to run?

The Page.Validate() method is used to force all the validation controls to run and to perform validation.

31. Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?

The RedirectPermanent() method added in ASP.NET 4.0 to redirect a page permanently.

32. How can you send an email message from an ASP.NET Web page?

You can use the System.Net.Mail.MailMessage and the System.Net.Mail.SmtpMail classes to send an email in your Web pages. In order to send an email through your mail server, you need to create an object of the SmtpClient class and set the server name, port, and credentials.

33. What is the difference between the Response.Write() and Response.Output.Write() methods?

The Response.Write() method allows you to write the normal output; whereas, the Response.Output.Write() method allows you to write the formatted output.

34. What does the Orientation property do in a Menu control?

Orientation property of the Menu control sets the horizontal or vertical display of a menu on a Web page. By default, the orientation is vertical.

35. Can we validate a DropDownList by RequiredFieldValidator?

Yes, we can validate a DropDownList by RequiredFieldValidator. To perform this validation, we have to set the InitialValue property of RequiredFieldValidator control.

36. What are the various ways of authentication techniques in ASP.NET?

There are three ways of authentication in ASP.NET:

Windows Authentication
Forms Authentication

37. What is the difference between a HyperLink control and a LinkButton control?

A HyperLink control does not have the Click and Command events; whereas, the LinkButton control has these events, which can be handled in the code-behind file of the Web page.

38. How will your write server-side comments?

<%--This is an example of server-side comments --%>

39. How do you prevent a validation control from validating data at the client end?

You can prohibit a validation control to validate data at the client side by setting the EnableClientScript property to False.

40. What do you mean by a neutral culture?

When you specify a language but do not specify the associated country through a culture, the culture is called as a neutral culture.

No comments:

Post a Comment