Interview Questions





ASP.NET QUESTIONS


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

System.Environment.UserName

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

Button

3. Where the private assembly is stored in asp.net?.

application / bin directory 

4. Where the public assembly is stored in asp.net?.

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.

1)Page_PreInit
2)Page_Init
3)Page_InitComplete
4)Page_PreLoad
5)Page_Load
6)Control Events
7)Page_LoadComplete
8)Page_PreRender
9)SaveViewState
10)Page_Render
11)Page_Unload

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
Passport 

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.   

ASP.Net Objective Questions
Question :
Which of the following are correct controls in ASP.NET Source View?()
1.< asp:textbox runat="server" id="Msg" text="Hello, R4R" />
2.< asp:button runat="server" id="Send" text="Send" onclick="Send_Click" />
3. None
 
4. Both
Answer:4. Both

Question :
Which is used to add event code(on C# Code) for TextBox control in Source view ( ASP.NET)
1. MsgSent.Text = Msg.Text;
2. MsgSent.Text = Msg.Text
3. Both
4. None
Answer:1. MsgSent.Text = Msg.Text;

Question :
Which is used for code-in-line model?
1.< script runat="server">
2.< script javascript="server">
3.Both
4.None
Answer:1.< script runat="server">
 

Question :
Which is code allows the modification of the head tag at runtime?
1 < head runat="server">
2.< script javascript="server">
3.Both
4.None
Answer:1 < head runat="server">

Question :
How you can change the page title by changing the using C#
 
1.void buttonSet_Click(Object sender, EventArgs earg)
 
{
 
Header.Title :Msg.Text;
 
}
2.void buttonSet_Click(Object sender, EventArgs earg)
 
{
 
Msg.Text= Header.Title;
 
}
3.void buttonSet_Click(Object sender, EventArgs earg)
 
{
 
Msg.Text: Header.Title;
 
}
4.None
Answer:1.void buttonSet_Click(Object sender, EventArgs earg)
 
{
 
Header.Title :Msg.Text;
 
}

Question :
Which is not used into @Page attributes
1. Async ,CodeFile
 
2. EnableTheming, MasterPageFile
 
3. MaintainScrollPositionOnPostback Theme
4. None
5. All
Answer:4. None

Question :
Which is true to bind a method by setting the Master attribute in the
 ?
1. < configuration>
< system.web>
< pages masterpagefile="r4r.co.in.MasterPage" />


2. < pages>
< system.web>
< pages masterpagefile="r4r.co.in.MasterPage" />


3.Both
4.None
Answer:1. < configuration>
< system.web>
< pages masterpagefile="r4r.co.in.MasterPage" />

Question :
@Page directive

The above syntax is used to make the Master property typed to the class that is stored in the referenced master on ASP page.
1.Yes
2.No
 
Answer:1.Yes

Question :
ASP.NET Supports “Nested Master Page”
 
1.Yes
2.No
 
Answer:1.Yes

Question :
Which is true ?
1. Page Class is a derivative of the Control class.
2. Page Class inherits all properties, methods, and events exposed by the Control class.
3.Both
4. None
Answer:3.Both

Question :
Which of the following properties are not expose by Page Class?
1.Cache, IsPostBack
2 ErrorPage3,IsValid, Trace, and Validators
3.Both
4.None
Answer:3.Both

Question :
Choose all true options only
 
1. HtmlImage is HTMLControl for image and it used for html tag
 
2. HtmlInputHidden Used for hidden just like form fields
 
3. HtmlInputImage is HTMLControl for Image and it used for html input tag
 
4.None
Answer:1,2,3

Question :
Correct syntax of ASP.NET directive:
 
1..
2..
3.<@ directive [attribute=value] %>.
4.<@ directive [attribute=value] >.
Answer: 1.

Question :
The namespaces that are automatically imported into all ASP.NET pages
1.System,System.Collections, System.IO
2.System.Web,System. Web.UI
3.System.Web.UI.HtmlControls,System. Web.UI.WebControls
A . 1
B. 1,2,3
C, 2,3
D. None
Answer:B. 1,2,3

Question :
The ASP.NET pages directives are
 
1. @ Page,@ Control,@ Import,@ Register
2. @ Assembly, @ OutputCache
3. System.Web.UI.HtmlControls,System. Web.UI.WebControls
A . 1,2
B. 1,2,3
C, 2,3
D. None
Answer:A . 1,2

Question :
Syntax for Code Declaration Blocks
1. < script runat="server" [language="language"]>
//code……………….

2.
 
//code……………….

3. 1 and 2
4. None
Answer:1. < script runat="server" [language="language"]>
//code……………….

Question :
Syntax for Assembly directive specifies
1. < Assembly runat="server" [language="language"]>
//code……………….

2.
 
3. 1 and 2
4. None
Answer:2.
 

Question :
Syntax for Register directive specifies
1. < Register runat="server" [language="language"]>
//code……………….

2.
 
3. 1 and 2
4. None
Answer:2.
 

Question :
Syntax for Import directive specifies
1.
 
2.
 
3. 1 and 2
4. None
Answer:3. 1 and 2

Question :
Syntax for Custom-Control to insert a custom control into a page
1.
 
2.
 
3. 1 and 2
4. None
Answer:1.
 

Question :
Server-Side Object Tags are:
1.Statically declare and instantiate COM and .NET objects.
2. syntax to declare server-side objects is:
< object id="id" runat="server" class=".net class name">
< object id="id" runat="server" progid="COM ProgID">
< object id="id" runat="server" classid="COM classID">
3. 1 and 2
4. None
Answer:3. 1 and 2
 
 
 
Question :
Choose correct for Custom Server Controls
 
1. Two ways of creating custom server controls.
2. The pagelet approach, which is easy to do but rather limited in functionality
3. Control base class (or UserControl) derivative approach
A. 1,2,3
B. 1,2
C. 3
D. 1,3
E. None
Answer:A. 1,2,3

Question :

Syntax for Pagelets
1. < !-- #include file="url" -->
2. < %@ include Namespace="System.Data" %>
3. 1 and 2
4. None


1 comment:

Contact Form

Name

Email *

Message *