Explore topic-wise InterviewSolutions in Current Affairs.

This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.

1.

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?

Answer»

You must SET the DATASOURCE PROPERTY and CALL the DataBind method.

You must set the DataSource property and call the DataBind method.

2.

How Can You Provide An Alternating Color Scheme In A Repeater Control?

Answer»

USE the AlternatingItemTemplate.

Use the AlternatingItemTemplate.

3.

Which Template Must You Provide, In Order To Display Data In A Repeater Control?

Answer»

ItemTemplate.

ItemTemplate.

4.

Can You Edit Data In The Repeater Control?

Answer»

No,

it just READS the INFORMATION from its DATA SOURCE.

No,

it just reads the information from its data source.

5.

Which Method Do You Invoke On The Dataadapter Control To Load Your Generated Dataset With Data?

Answer»

The FILL() METHOD.

The Fill() method.

6.

What Is Msil, And Why Should My Developers Need An Appreciation Of It If At All?

Answer»

MSIL is the MICROSOFT INTERMEDIATE Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET FRAMEWORK to JIT compile the assembly on the installed computer.

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

7.

Explain What A Diffgram Is, And A Good Use For One?

Answer»

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.

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.

8.

Describe The Difference Between Inline And Code Behind?

Answer»

Inline code is written along with the html code in a PAGE. Code-behind is code written in a SEPARATE FILE and REFERENCED by the .aspx page.

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

9.

Whats An Assembly?

Answer»

ASSEMBLIES are the BUILDING BLOCKS of the .NET FRAMEWORK. Overview of assemblies from MSDN.

Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN.

10.

Can You Explain What Inheritance Is And An Example Of When You Might Use It?

Answer»

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.

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.

11.

What Are The Application_start And Session_start Subroutines Used For?

Answer»

This is where you can SET the specific VARIABLES for the APPLICATION and SESSION OBJECTS.

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

12.

What Is The Global.asax Used For?

Answer»

The Global.asax (including the Global.asax.cs FILE) is USED to implement application and session LEVEL events.

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

13.

Can You Explain The Difference Between An Ado.net Dataset And An Ado Recordset?

Answer»

Valid answers are:

  • 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.

  • DataSets have no current record pointer You can use For Each 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.

Valid answers are:

There's no concept of cursor types in a DataSet.

14.

What Is The Difference Between Server.transfer And Response.redirect? Why Would I Choose One Over The Other?

Answer»

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 clients url history list or current url. Response.Redirect is used to redirect the user's browser to ANOTHER page or site. This perform as 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.

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 clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This perform as 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.

15.

Should User Input Data Validation Occur Server-side Or Client-side? Why?

Answer»

All USER input data validation should occur on the server at a MINIMUM. Additionally, client-side validation can be performed where deemed APPROPRIATE and feasable to provide a richer, more responsive EXPERIENCE for the user.

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

16.

What Type Of Code (server Or Client) Is Found In A Code-behind Class?

Answer»

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 CLIENTS browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

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 clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

17.

Explain The Differences Between Server-side And Client-side Code?

Answer»

SERVER-side CODE EXECUTES on the server. CLIENT-side code executes in the client's BROWSER.

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

18.

What Data Types Do The Rangevalidator Control Support?

Answer»

INTEGER, STRING, and DATE.

Integer, String, and Date.

19.

Suppose You Want A Certain Asp.net Function Executed On Mouseover For A Certain Button. Where Do You Add An Event Handler?

Answer»

ADD an OnMouseOver ATTRIBUTE to the BUTTON.

EXAMPLE: btnSubmit.Attributes.Add ("onmouseover","someClient CodeHere();");

Add an OnMouseOver attribute to the button.

Example: btnSubmit.Attributes.Add ("onmouseover","someClient CodeHere();");

20.

What's A Bubbled Event?

Answer»

When you have a complex CONTROL, like DataGrid, WRITING an EVENT processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, ALLOWING the main DataGrid event HANDLER to take care of its constituents.

When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

21.

What's The Difference Between Codebehind="mycode.aspx.cs" Andsrc="mycode.aspx.cs"?

Answer»

CodeBehind is RELEVANT to VISUAL Studio.NET only.

CodeBehind is relevant to Visual Studio.NET only.

22.

Where Do You Store The Information About The User's Locale?

Answer»

System.Web.UI.Page.Culture

System.Web.UI.Page.Culture

23.

What Namespace Does The Web Page Belong In The .net Framework Class Hierarchy?

Answer»

ANSWER :System.Web.UI.Page

24.

When During The Page Processing Cycle Is Viewstate Available?

Answer»

After the INIT() and before the Page_Load(), or ONLOAD() for a CONTROL.

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

25.

What Methods Are Fired During The Page Load?

Answer»
  • 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.

26.

What's The Difference Between Response.write() Andresponse.output.write()?

Answer»

Response.OUTPUT.WRITE() ALLOWS you to write FORMATTED output.

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

27.

Describe The Role Of Inetinfo.exe, Aspnet_isapi.dll And Aspnet_wp.exe In The Page Loading Process?

Answer»

inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests AMONG other things.When an ASP.NET REQUEST is received (usually a file with .aspx extension), the ISAPI FILTER aspnet_isapi.dll TAKES care of it by passing the request to the actual WORKER process aspnet_wp.exe.

inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

28.

How Can I Have A Particular Web Page In An Asp.net Application Which Displays Its Own Error Page?

Answer»

This can be done by SETTING the ErroPage attribute of Page DIRECTIVE or ErrorPage property of Page Class to the desired Custom Error Page

<%@Page Language="C#" ErrorPage="specificerropage.htm"%&GT;

In web.config

<customErrors MODE="On" />

This can be done by setting the ErroPage attribute of Page Directive or ErrorPage property of Page Class to the desired Custom Error Page

<%@Page Language="C#" ErrorPage="specificerropage.htm"%>

In web.config

<customErrors mode="On" />

29.

Can I Use Custom .net Data Types In A Web Form?

Answer»

Yes.

Place the DLL containing the type in the application root's bin directory and ASP.NET will AUTOMATICALLY LOAD the DLL when the type is referenced. This is ALSO what happens when you add a custom control from the TOOLBOX to your web form.

Yes.

Place the DLL containing the type in the application root's bin directory and ASP.NET will automatically load the DLL when the type is referenced. This is also what happens when you add a custom control from the toolbox to your web form.

30.

Can Two Different Programming Languages Be Mixed In A Single Aspx File?

Answer»

No.

ASP.NET uses parsers to STRIP the code from ASPX FILES and copy it to temporary files CONTAINING derived PAGE classes, and a given parser understands only one language.

No.

ASP.NET uses parsers to strip the code from ASPX files and copy it to temporary files containing derived Page classes, and a given parser understands only one language.

31.

How To Format A Telphone Number In The Xxx-xxx-xxxx Format?

Answer»

VB.NET

DIM Telno As DOUBLE = Double.Parse(ds.Tables(0).ROWS(0)("TelNo"). TOSTRING())
Response.Write(Telno.ToString("###-###-####"))

C#

double Telno= double.Parse(ds.Tables[0].Rows[0]["TelNo"]. ToString());
Response.Write(Telno.ToString("###-###-####"));

VB.NET

Dim Telno As Double = Double.Parse(ds.Tables(0).Rows(0)("TelNo"). ToString())
Response.Write(Telno.ToString("###-###-####"))

C#

double Telno= double.Parse(ds.Tables[0].Rows[0]["TelNo"]. ToString());
Response.Write(Telno.ToString("###-###-####"));

32.

Can I Use A Datareader To Update/insert/delete A Record?

Answer»

No.

DataReader PROVIDES a means of READING a forward-only stream of rows from a DATABASE.

No.

DataReader provides a means of reading a forward-only stream of rows from a database.

33.

How To Make Vs.net Use Flowlayout As The Default Layout Rather Than The Gridlayout?

Answer»

For VB.NET, go to path C:Program Files Microsoft VISUAL Studio .NET Vb7 VBWizards WebForm Templates 1033

Change the following line in the existing WebForm1.aspx

<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to

For C#, go to path C: Program Files Microsoft Visual Studio .NET 2003 VC# VC# Wizards CSharp WebApp Wiz Templates 1033

Change the following line in the existing WebForm1.aspx

<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to

Note:Before changing any templates it's a GOOD idea to make backup COPIES of them Or rather than above approach you can change the behavior for new files on a per project basis in Visual Studio by:

  1. Right clicking on the project name (Ex: "WebApplication1)" in Solution Explorer, and select "Properties".
  2. From project properties window, under Common Properties>Designer Defaults>Page LAYOUT change "Grid" to "Flow".

For VB.NET, go to path C:Program Files Microsoft Visual Studio .NET Vb7 VBWizards WebForm Templates 1033

Change the following line in the existing WebForm1.aspx

<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to

For C#, go to path C: Program Files Microsoft Visual Studio .NET 2003 VC# VC# Wizards CSharp WebApp Wiz Templates 1033

Change the following line in the existing WebForm1.aspx

<body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to

Note:Before changing any templates it's a good idea to make backup copies of them Or rather than above approach you can change the behavior for new files on a per project basis in Visual Studio by:

34.

How To Automatically Get The Latest Version Of All The Asp.net Solution Items From Source Safe When Opening The Solution?

Answer»

In VS.NET you can GO to Tools > Options > SOURCE Control > General and CHECK the checkbox for Get everything when a solution opens.This retrieves the LATEST version of all solution items when you open the solution.

In VS.NET you can go to Tools > Options > Source Control > General and check the checkbox for Get everything when a solution opens.This retrieves the latest version of all solution items when you open the solution.

35.

Is It Possible To Migrate Visual Interdev Design-time Controls To Asp.net?

Answer»

In VS.NET you can go to Tools > Options > Source Control > General and CHECK the CHECKBOX for GET everything when a solution OPENS. This retrieves the latest VERSION of all solution items when you open the solution.

In VS.NET you can go to Tools > Options > Source Control > General and check the checkbox for Get everything when a solution opens. This retrieves the latest version of all solution items when you open the solution.

36.

Can Asp.net Work On An Nt Server?

Answer»

No.

For more DETAILS REFER ASP 1.1 VERSION.

No.

For more details refer ASP 1.1 version.

37.

Why Is Default.aspx Page Not Opened If I Specify Http://localhost. I Am Able To View This Page If I Hardcode It As Http://localhost/default.aspx?

Answer»

If some other default page comes higher in the list, adjust the default.aspx to be the number one entry inside the IIS configuration. If you have multiple WEBSITES inside IIS, make SURE the configuration is applied on the right website (or on all websites by applying the configuration on the server-level using the PROPERTIES dialog, CONFIGURE WWW service).

If some other default page comes higher in the list, adjust the default.aspx to be the number one entry inside the IIS configuration. If you have multiple websites inside IIS, make sure the configuration is applied on the right website (or on all websites by applying the configuration on the server-level using the properties dialog, configure WWW service).

38.

Why Do I Get The Error Message "object Must Implement Iconvertible". How Can I Resolve It?

Answer»

The COMMON cause for this error is SPECIFYING a control as a SqlParameter's Value instead of the control's text value.For example, if you write CODE as below you'll get the above error:

VB.NET

DIM nameParameter As SqlParameter = command.Parameters.Add ("@name",SqlDbType.NVarChar,50)
nameParameter.Value = txtName

C#

SqlParameter nameParameter = command.Parameters.Add("@name", SqlDbType.NVarChar, 50);
nameParameter.Value = txtName ;

To resolve it, SPECIFY the control's Text property instead of the control itself.

VB.NET

nameParameter.Value = txtName.Text

C#

nameParameter.Value =txtName.Text;

The common cause for this error is specifying a control as a SqlParameter's Value instead of the control's text value.For example, if you write code as below you'll get the above error:

VB.NET

Dim nameParameter As SqlParameter = command.Parameters.Add ("@name",SqlDbType.NVarChar,50)
nameParameter.Value = txtName

C#

SqlParameter nameParameter = command.Parameters.Add("@name", SqlDbType.NVarChar, 50);
nameParameter.Value = txtName ;

To resolve it, specify the control's Text property instead of the control itself.

VB.NET

nameParameter.Value = txtName.Text

C#

nameParameter.Value =txtName.Text;

39.

How To Change The Page Title Dynamically?

Answer»

&LT;TITLE id="Title1" runat =server&GT;</TITLE>

VB.NET
'Declare Protected WithEvents Title1 As System.Web.UI.HtmlControls. HtmlGenericControl
'In Page_Load Title1.InnerText ="PAGE 1"

C#
//Declare protected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ;
//In Page_Load Title1.InnerText ="Page 1" ;

<TITLE id="Title1" runat =server></TITLE>

VB.NET
'Declare Protected WithEvents Title1 As System.Web.UI.HtmlControls. HtmlGenericControl
'In Page_Load Title1.InnerText ="Page 1"

C#
//Declare protected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ;
//In Page_Load Title1.InnerText ="Page 1" ;

40.

How Can I Specify The "upload A File" Input Textbox In A Form To Be Read Only So That The User Can Click On The Browse Button And Pick A File But They Cannot Type Anything Into The Textbox Next To The Browse Button.

Answer»

<input ID="File1" type="file" contenteditable=false/&GT;

<input id="File1" type="file" contenteditable=false/>

41.

How Can I Specify The Relative Path For A File?

Answer»

SUPPOSE you have following FILE hierarchy:

default.aspx
Admin/login.aspx
Misc/testpage.aspx

And you are on the login.aspx and want your user to NAVIGATE to the default.aspx (or testpage.aspx) file. Then you can USE

  • Response.Redirect ("../default.aspx").
  • Response.Redirect ("../Misc/testpage.aspx").

Suppose you have following file hierarchy:

default.aspx
Admin/login.aspx
Misc/testpage.aspx

And you are on the login.aspx and want your user to navigate to the default.aspx (or testpage.aspx) file. Then you can use

42.

What Permissions Do Asp.net Applications Posses By Default?

Answer»

By DEFAULT ASP.NET Web APPLICATIONS run as ASP.NET user. This user has limited permissions EQUIVALENT to the User GROUP.

By default ASP.NET Web applications run as ASP.NET user. This user has limited permissions equivalent to the User Group.

43.

What Is The Different Between &lt;%# %&gt; And &lt;%= %&gt;?

Answer»

The &LT;%# %> is USED for databinding where as <%= %> is used to output the result of an expression. The expression inside <%# %> will be executed only when you call the page's or CONTROL's DataBind METHOD. The expression inside <%= %> will be executed and displayed as and when it appears in the page.

The <%# %> is used for databinding where as <%= %> is used to output the result of an expression. The expression inside <%# %> will be executed only when you call the page's or control's DataBind method. The expression inside <%= %> will be executed and displayed as and when it appears in the page.

44.

What Is The Meaning Of Validaterequest=true In .net Framework1.1?

Answer»

The value of validateRequest is SET to 'true' by DEFAULT, which means that the FRAMEWORK will automatically DENY submission of the '<'and'>' characters.

The value of validateRequest is set to 'true' by default, which means that the framework will automatically deny submission of the '<'and'>' characters.

45.

How To Get The Hostname Or Ip Address Of The Server?

Answer»

You can use EITHER of these:

  • HttpContext.Current.Server.MachineName
  • HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]

The first one should RETURN the name of the MACHINE, the second returns the local ip address.

Note: that name of the machine could be different than HOST, since your site could be using host headers.

You can use either of these:

The first one should return the name of the machine, the second returns the local ip address.

Note: that name of the machine could be different than host, since your site could be using host headers.

46.

What Is The Difference Between Response.redirect() And Server.transfer().

Answer»

Response.Redirect

  • Tranfers the page control to the other page, in other words it sends the request to the other page.
  • Causes the client to navigate to the page you are redirecting to. In http terms it sends a 302 response to the client, and the client GOES where it's told.

Server.Transfer

  • Only transfers the execution to ANOTHER page and during this you will SEE the URL of the old page since only execution is transfered to new page and not control.
  • OCCURS entirely on the server, no action is needed by the client Sometimes for PERFORMANCE reasons, the server method is more desirable

Response.Redirect

Server.Transfer

47.

Is It Possible To Write Code In Many Languages In One Asp.net Project?

Answer»

You cannot WRITE the code-behind FILES in DIFFERENT languages in the same PROJECT, but you can write the ASPX pages and ascx controls in different languages.

You cannot write the code-behind files in different languages in the same project, but you can write the aspx pages and ascx controls in different languages.

48.

How To Check If The User Is Using A Secure Or Non Secure Connection?

Answer»

The Request Object DEFINES a PROPERTY CALLED IsSecureConnection, that will indicate whether HTTP:// or HTTPS:// has been used.

The Request Object defines a Property called IsSecureConnection, that will indicate whether http:// or https:// has been used.

49.

How To Hide Or Show Controls In Server Side Code?

Answer»

In any APPROPRIATE EVENT WRITE
VB.NET
TextBox1.Visible =not TextBox1.Visible

C#
TextBox1.Visible =!TextBox1.Visible;

In any appropriate event write
VB.NET
TextBox1.Visible =not TextBox1.Visible

C#
TextBox1.Visible =!TextBox1.Visible;

50.

When The User Is Prompted A File Download Dialogbox, If The User Selects "save" Then The "save As" Dialog Box Is Displayed. Is There Any Way For Me To Retrieve The Filename And Directory Path Specified By The User On The File Download Dialog Box?

Answer»

Clients do not report information back about where the USER selects to save the CONTENT, so there isn't an easy way to do this. Instead, you would need to ask the user before using the content-disposition for a FILE path, and then you could SPECIFY the filename parameter for the content-disposition header. Still, the user is free to change that path when actually downloading.

Clients do not report information back about where the user selects to save the content, so there isn't an easy way to do this. Instead, you would need to ask the user before using the content-disposition for a file path, and then you could specify the filename parameter for the content-disposition header. Still, the user is free to change that path when actually downloading.