NET WebDev Interview Questions

25
.NET WebDev interview questions - Part 3 1. State True or False: If you set AutoGenerateColumns=True and still provide custom column definitions, the DataGrid will render both o True o False 2. The data from an XSL Transform with XmlReader can be returned in one of the following ways o objReader = objXslT.Transform(objNav, nothing) o objXslT.Transform(objNav, nothing) o objReader = objXslT.Transform(objNav, nothing, objWriter) o objXslT.Transform(objNav, nothing, objWriter) 3. Pick the command line that would result in the C# compiler generating an XML documentation file o csc /doc:NewHome.xml NewHome.cs o c /doc /docfile: NewHome.xml NewHome.cs o csc /doc /out: NewHome.xml NewHome.cs o csc /xml NewHome.cs 4. What is the comment syntax for C# ’s XML-based documentation? o /** and **/ o //# o /// o //* 5. When creating a C# Class Library project, what is the name of the supplementary file that Visual Studio.NET creates that contains General Information about the assembly? o AssemblyInfo.xml o AssemblyInfo.cs o AssemblyInformation.cs o AssemblyAttributes.cs 6. Which of the following is the C# escape character for Null? o \n o \0 o \f

Transcript of NET WebDev Interview Questions

Page 1: NET WebDev Interview Questions

.NET WebDev interview questions - Part 3

1. State True or False: If you set AutoGenerateColumns=True and still provide custom column definitions, the DataGrid will render both

o True o False

2. The data from an XSL Transform with XmlReader can be returned in one of the following ways

o objReader = objXslT.Transform(objNav, nothing) o objXslT.Transform(objNav, nothing) o objReader = objXslT.Transform(objNav, nothing, objWriter) o objXslT.Transform(objNav, nothing, objWriter)

3. Pick the command line that would result in the C# compiler generating an XML documentation file

o csc /doc:NewHome.xml NewHome.cso c /doc /docfile: NewHome.xml NewHome.cs o csc /doc /out: NewHome.xml NewHome.cso csc /xml NewHome.cs

4. What is the comment syntax for C#’s XML-based documentation? o /** and **/ o //# o /// o //*

5. When creating a C# Class Library project, what is the name of the supplementary file that Visual Studio.NET creates that contains General Information about the assembly?

o AssemblyInfo.xmlo AssemblyInfo.cs o AssemblyInformation.cso AssemblyAttributes.cs

6. Which of the following is the C# escape character for Null? o \n o \0 o \f o \v

7. What is the exception that is thrown when there is an attempt to dynamically access a method that does not exist?

o MissingMethodException o TypeLoadException o MethodLoadException o MethodAccessException

8. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time?

o Synchronize() o Lock() and UnLock()

Page 2: NET WebDev Interview Questions

o Lock() o Asynchroize()

9. After capturing the SelectedIndexChanged event for a ListBox control, you find that the event handler doesn’t execute. What could the problem be?

o The AutoEventWireup attribute is set to False o The AutomaticPostBack attribute is set to False o The codebehind module is not properly compiled o The ListBox must be defined WithEvents

10. What method must be overridden in a custom control? o The Paint() method o The Control_Build() methodo The Render() method o The default constructor

11. What is used to validate complex string patterns like an e-mail address? o Extended expressions o Regular expressions o Irregular expressions o Basic expressions

12. The following is a valid statement in ASP.NET<%@ Page Language="C" %> o True o False

13. A valid comment block in ASP.NET is o <!- - - Comment - - - > o <!- - Comment - - > o <% - - Comment - - %> o <% ! - - Comment - - >

14. The event handlers that can be included in the Global.asax file are o Application Start and

Session Start event handlers only o Application End and

Session End event handlers only o Per-request and Non-deterministic event handlers only o Application Start and End ,

Session Start and End, Per-request and Non-deterministic event handlers15. A Few of the Namespaces that get imported by default in an ASPX file are

o System , System.Data, System.Drawing,System.Globalization

o System ,System.IO, System.Management, System.Globalization

o System , System.Collections,System.Text, System.Web

o System ,System .NET ,System.Reflection, System.Web

16. The Assemblies that can be referenced in an ASPX file without using @Assembly Directive is

Page 3: NET WebDev Interview Questions

o System .dll, System.Data.dll,System.Web.dll, System.Xml.dll,

o System .dll,System.Collections.dll, System.IO.dll

o System .dll, System.Reflection.dll,System.Globalization.dll,

o System .Drawing.dll, System.Assembly.dll,System.Text.dll

17. An .ASHX file contains the following o Code-behind that are used in the code o Server Controls that can be called from a code-behind file o HTTP handlers-software modules that handle raw HTTP requests received

by ASP.NET o Contains normal ASP.NET code and can be used as an include file

18. What is the output for the following code snippet:19. public class testClass20. {21. public static void Main(string[] args)22. {23. System.Console.WriteLine(args[1]);24. }//end Main

}//end class testClass

o Compiler Error o Runtime Error o Hello C# world o None of the above

25. One of the possible way of writing an ASP.NET handler that works like an ISAPI filter- that is, that sees requests and responses and modifies them also, is by,

o writing a module that extends FormsAuthenticatonModule and using it o writing a component class that extends HttpModuleCollection and using it o writing an HTTP module-a Class that implements IhttpModule and

registering it in Web.Config o All of the above

26. The ASP.NET directive that lets you cache different versions of a page based on varying input parameters, HTTP headers and browser type is

o @OutputCache o @CacheOutput o @PageCache o @CacheAll

27. If we develop an application that must accommodate multiple security levels through secure login and ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?

o <SessionState mode="InProc"stateConnectionString=" tcpip=127.0.0.1:42424" sqlConnectionString=" data source=127.0.0.1;user id=sa;password="cookieless="false" timeout="30" />

Page 4: NET WebDev Interview Questions

o <SessionState mode="OutProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="30" />

o <SessionState mode="stateserver" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="30" />

28. What is the output for the below mentioned compilation command>csc /addmodule:A.Exe B.Cs

o A.exe o B.exe o A.dll o B.dll

29. How can be the web application get configured with the following authorization rules

o Anonymous users must not be allowed to access the application. o All persons except David and John must be allowed to access the

application. <authorization><deny users = "applicationname\David,

applicationname\John" ><allow roles ="*"><deny roles = "?"></authorization>

<authorization><allow users ="*"><deny users = "applicationname\David; applicationname\John" ><deny users = "*"></authorization>

<authorization><deny users = "applicationname\David, applicationname\John" ><deny users = "?"><allow users ="*"></authorization>

<authorization><allow users ="*"><deny users = "applicationname\David, applicationname\John" ></authorization>

30. What will be the output of the following code snippet?31. using System;32. class MainClass33. {34. static void Main( )35. {36. new MainClass().Display( 3.56 );37. }38.39. private void Display( float anArg )40. {41. Console.Write( “{0} {1}”,

anArg.GetType(), anArg );42. }43.44. double Display( double anArg )45. {46. Console.Write( “{0} {1}”,

anArg.GetType(), anArg );47. return anArg;

Page 5: NET WebDev Interview Questions

48. }49.50. public decimal Display( decimal anArg )51. {52. Console.Write( “{0} {1}”,

anArg.GetType(), anArg ); return anArg;53. }54. }

o System .Single 3.56 o System .Float 3.56 o System .Double 3.56 o System .Decimal 3.56

55. What will be output for the given code?56. Dim I as integer = 557. Do58. I = I + 259. Response.Write (I & " ")60. Loop Until I > 10

o 5 8 o 5 7 9 o 7 9 11 o Errors out

Read all | Browse topics: .NET, Web dev

53 Comments »

1. 25. What will be output for the given code?

Dim I as integer = 5DoI = I + 2Response.Write (I & \” \”)Loop Until I > 10

o/p: It generates error because of \” \”. (VB.NET)

Tech Interviews comment by Sasidhara Kumar Karasi

2. 18. What is the output for the following code snippet:

public class testClass{public static void Main(string[] args){System.Console.WriteLine(args[1]);}//end Main}//end class testClass

Page 6: NET WebDev Interview Questions

O/P:Runtime ErrorSystem.IndexOutOfRangeException.

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

3. 4. What is the comment syntax for C#’s XML-based documentation?

* /** and **/* //#* ///* //*

Ans: ///

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

4. 3. Pick the command line that would result in the C# compiler generating an XML documentation file

A csc /doc:NewHome.xml NewHome.csB c /doc /docfile: NewHome.xml NewHome.csC csc /doc /out: NewHome.xml NewHome.csD csc /xml NewHome.cs

Ans: A

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

5. 6. Which of the following is the C# escape character for Null?

* \n** \f* \v

Ans:

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

6. 7. What is the exception that is thrown when there is an attempt to dynamically access a method that does not exist?

* MissingMethodException* TypeLoadException

Page 7: NET WebDev Interview Questions

* MethodLoadException* MethodAccessException

Ans: MissingMethodException

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

7. 24. What will be the output of the following code snippet?

using System;class MainClass{static void Main( ){new MainClass().Display( 3.56 );}

private void Display( float anArg ){Console.Write( “{0} {1}”, anArg.GetType(), anArg );}

double Display( double anArg ){Console.Write( “{0} {1}”, anArg.GetType(), anArg );return anArg;}

public decimal Display( decimal anArg ){Console.Write( “{0} {1}”, anArg.GetType(), anArg ); return anArg;}}

* System.Single 3.56* System.Float 3.56* System.Double 3.56* System.Decimal 3.56

Ans: System.Double 3.56

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

8. 11. What is used to validate complex string patterns like an e-mail address?

Page 8: NET WebDev Interview Questions

* Extended expressions* Regular expressions* Irregular expressions* Basic expressions

Ans: Regular Expression.

We can get more information from the following site.http://support.microsoft.com/kb/308252

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

9. 10. # What method must be overridden in a custom control?

* The Paint() method* The Control_Build() method* The Render() method* The default constructor

Ans: The Render() method

_________________________________Love like you’ve never been hurtSasi. 09372423916

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

10. 9. After capturing the SelectedIndexChanged event for a ListBox control, you find that the event handler doesn’t execute. What could the problem be?

* The AutoEventWireup attribute is set to False* The AutomaticPostBack attribute is set to False* The codebehind module is not properly compiled* The ListBox must be defined WithEvents

Ans: The AutoPostBack is set to False.

Try using the following code:TheListBox.AutoPostBack = true;TheListBox.ID = “ListBoxCheck”;TheListBox.SelectedIndexChanged += newEventHandler(TheListBox_SelectedIndexChanged);

___________________________________Sasi

Page 9: NET WebDev Interview Questions

Tech Interviews comment by Sasidhara Kumar Karasi ([email protected])

11. 6. Which of the following is the C# escape character for Null?

* \n** \f* \v

Ans:

Tech Interviews comment by jaison

12. Hi, I have installed .NET & trying to open C# with ASP.NET project. But it says “The webserver reported the following error when attempting to create or open the web project located at the following URL: ‘http://localhost/webapplication1. ‘The login request was denied’ “. Could someone please help me how to run ASP.NET projects in my system.

Tech Interviews comment by Suresh

13. 14. The event handlers that can be included in the Global.asax file are

1 Application Start andSession Start event handlers only2 Application End andSession End event handlers only3 Per-request and Non-deterministic event handlers only4 Application Start and End ,Session Start and End, Per-request and Non-deterministic event handlersAns: 4—————————-The Events in Global.asax file areApplication_StartApplication_InitApplication_DisposedApplication_ErrorApplication_EndApplication_BeginRequestApplication_EndRequestApplication_PreRequestHandlerExecuteApplication_PostRequestHandlerExecuteApplication_PreSendRequestHeadersApplication_PreSendRequestContentApplication_AcquireRequestStateApplication_ReleaseRequestState

Page 10: NET WebDev Interview Questions

Application_AuthenticateRequestApplication_AuthorizeRequest

Session_StartSession_End

_______Sasi. ;-)——-

Tech Interviews comment by Sasidhara Kumar Karasi

14. 1.False.It will only show Auto generated columns.If the custom defined columns are called on pageload, it shows them but on the occuring of an event which generates columns automatically, the previous rendering will be replaced by auto generated columns.

Tech Interviews comment by Yuva

15. Q 15 Ans cQ 16 Ans A

Tech Interviews comment by webdeveloper

16. 20 A23

1312 false c not supported

Tech Interviews comment by webdeveloper

17. 1. Answer is True(Checked with MSDN) It will render both Custom columns and autogenerated columns. Custom columns will be rendered first before others columns are rendered .

Tech Interviews comment by Aravindhan

18. For the first question, autogenerate and custom defined columns , its rendering both. In my case autogenerate is true and i have defined a databound column, so i am getting that custom defined column as well as autogenerated columns, then the answer for the first question should be true, if not can somebody explain me how come this is false.

Page 11: NET WebDev Interview Questions

Tech Interviews comment by austin

19. 23)How can be the web application get configured with the following authorization rulesAnonymous users must not be allowed to access the application.All persons except David and John must be allowed to access the application.

ans:c

Tech Interviews comment by pavan

20. Ans 6 : ‘’ for null

Tech Interviews comment by Amit

21. Ans 2 : b)objXslT.Transform(objNav, nothing)

Tech Interviews comment by Amit Kumar Sinha

22. MissingMethod Excception

Tech Interviews comment by Amit Kumar Sinha

23. Ans 8 Lock() so that multiple user can not acces your application

Tech Interviews comment by Amit Kumar Sinha

24. Ans 9 The Because AutoPostBack attribute is set to False

Tech Interviews comment by Amit Kumar Sinha

25. 1. State True or False: If you set AutoGenerateColumns=True and still provide custom column definitions, the DataGrid will render both*True*False

Answer:Custom declared columns may be used in conjunction with auto-generated columns. When using both, custom declared columns will be rendered first, followed by the auto-generated columns.

Tech Interviews comment by Stephany

26. 2. The data from an XSL Transform with XmlReader can be returned in one of the following ways

Page 12: NET WebDev Interview Questions

o objReader = objXslT.Transform(objNav, nothing)o objXslT.Transform(objNav, nothing)o objReader = objXslT.Transform(objNav, nothing, objWriter)o objXslT.Transform(objNav, nothing, objWriter)

Answer:objReader = objXslT.Transform(objNav, nothing)

Tech Interviews comment by Stephany

27. 3. Pick the command line that would result in the C# compiler generating an XML documentation fileo csc /doc:NewHome.xml NewHome.cso c /doc /docfile: NewHome.xml NewHome.cso csc /doc /out: NewHome.xml NewHome.cso csc /xml NewHome.csAnswer:csc /doc:NewHome.xml NewHome.cs

Tech Interviews comment by Stephany

28. 4 What is the comment syntax for C#’s XML-based documentation?o /** and **/o //#o ///o //*

Answer: ///

Tech Interviews comment by Stephany

29. 5. When creating a C# Class Library project, what is the name of the supplementary file that Visual Studio.NET creates that contains General Information about the assembly?o AssemblyInfo.xmlo AssemblyInfo.cso AssemblyInformation.cso AssemblyAttributes.cs

Answer: AssemblyInfo.cs

Tech Interviews comment by Stephany

30. 6.Which of the following is the C# escape character for Null?• \n•

Page 13: NET WebDev Interview Questions

• \f• \v

Answer:

Tech Interviews comment by Stephany

31. 7. What is the exception that is thrown when there is an attempt to dynamically access a method that does not exist?o MissingMethodExceptiono TypeLoadExceptiono MethodLoadExceptiono MethodAccessException

Answer: MissingMethodException

Tech Interviews comment by Stephany

32. 8. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time?o Synchronize()o Lock() and UnLock()o Lock()o Asynchroize()

Answer: Lock()

Tech Interviews comment by Stephany

33. 9. After capturing the SelectedIndexChanged event for a ListBox control, you find that the event handler doesn’t execute. What could the problem be?

o The AutoEventWireup attribute is set to Falseo The AutomaticPostBack attribute is set to Falseo The codebehind module is not properly compiledo The ListBox must be defined WithEventsAnswer:AutoPostBack attribute is set to False

Tech Interviews comment by Stephany

34. 10. What method must be overridden in a custom control?o The Paint() methodo The Control_Build() methodo The Render() methodo The default constructor

Page 14: NET WebDev Interview Questions

Answer: The Render() method

Tech Interviews comment by Stephany

35. 11. What is used to validate complex string patterns like an e-mail address?o Extended expressionso Regular expressionso Irregular expressionso Basic expressions

Answer: Regular expressions

Tech Interviews comment by Stephany

36. 12. The following is a valid statement in ASP.NETo Trueo False

Answer: False

Tech Interviews comment by Stephany

37. 13. A valid comment block in ASP.NET isa.b.c.d.

Answer:

Tech Interviews comment by Stephany

38. The event handlers that can be included in the Global.asax file areo Application Start andSession Start event handlers onlyo Application End andSession End event handlers onlyo Per-request and Non-deterministic event handlers onlyo Application Start and End ,Session Start and End, Per-request and Non-deterministic event handlers

Answer: Application Start and End ,Session Start and End, Per-request and Non-deterministic event handlers

Tech Interviews comment by Stephany

Page 15: NET WebDev Interview Questions

39. 15. A Few of the Namespaces that get imported by default in an ASPX file areo System, System.Data, System.Drawing,System.Globalizationo System,System.IO, System.Management, System.Globalizationo System, System.Collections,System.Text, System.Webo System,System.NET,System.Reflection, System.Web

Answer:System, System.Collections,System.Text, System.Web

Tech Interviews comment by Stephany

40. 16. The Assemblies that can be referenced in an ASPX file without using @Assembly Directive iso System.dll, System.Data.dll,System.Web.dll, System.Xml.dll,o System.dll,System.Collections.dll, System.IO.dllo System.dll, System.Reflection.dll,System.Globalization.dll,o System.Drawing.dll, System.Assembly.dll,System.Text.dll

Answer:System.dll, System.Data.dll,System.Web.dll, System.Xml.dll

Tech Interviews comment by Stephany

41. 17 An .ASHX file contains the followingo Code-behind that are used in the codeo Server Controls that can be called from a code-behind fileo HTTP handlers-software modules that handle raw HTTP requests received by ASP.NETo Contains normal ASP.NET code and can be used as an include file

Answer: HTTP handlers-software modules that handle raw HTTP requests received by ASP.NET

Tech Interviews comment by Stephany

Page 16: NET WebDev Interview Questions

42. 13. A valid comment block in ASP.NET is“”“”“”“”Answer: “”

Tech Interviews comment by Stephany

43. 18 What is the output for the following code snippet:public class testClass{public static void Main(string[] args){System.Console.WriteLine(args[1]);}//end Main}//end class testClass• Compiler Error• Runtime Error• Hello C# world• None of the above

Answer: Runtime Error

Tech Interviews comment by Stephany

44. 19 One of the possible way of writing an ASP.NET handler that works like an ISAPI filter- that is, that sees requests and responses and modifies them also, is by,• writing a module that extends FormsAuthenticatonModule and using it• writing a component class that extends HttpModuleCollection and using it• writing an HTTP module-a Class that implements IhttpModule and registering it in Web.Config• All of the aboveAnswer:writing an HTTP module-a Class that implements IhttpModule and registering it in Web.Config

Tech Interviews comment by Stephany

45. 20.The ASP.NET directive that lets you cache different versions of a page based on varying input parameters, HTTP headers and browser type iso @OutputCacheo @CacheOutputo @PageCacheo @CacheAll

Page 17: NET WebDev Interview Questions

Answer:@ OutputCache

Tech Interviews comment by Stephany

46. 21 If we develop an application that must accommodate multiple security levels through secure login and ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?

ooo

Answer:

Tech Interviews comment by Stephany

47. 21 If we develop an application that must accommodate multiple security levels through secure login and ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?o SessionState mode=”InProc”stateConnectionString=” tcpip=127.0.0.1:42424″ sqlConnectionString=” data source=127.0.0.1;user id=sa;password=”cookieless=”false” timeout=”30″o SessionState mode=”OutProc” stateConnectionString=”tcpip=127.0.0.1:42424″ sqlConnectionString=”data source=127.0.0.1;user id=sa;password=” cookieless=”false” timeout=”30″o SessionState mode=”stateserver” stateConnectionString=”tcpip=127.0.0.1:42424″ sqlConnectionString=”data source=127.0.0.1;user id=sa;password=” cookieless=”false” timeout=”30″

Answer:SessionState mode=”stateserver” stateConnectionString=”tcpip=127.0.0.1:42424″ sqlConnectionString=”data source=127.0.0.1;user id=sa;password=” cookieless=”false” timeout=”30″

Tech Interviews comment by Stephany

48. 22 What is the output for the below mentioned compilation command>csc /addmodule:A.Exe B.Cso A.exeo B.exeo A.dllo B.dll

Page 18: NET WebDev Interview Questions

Answer: B.exe

Tech Interviews comment by Stephany

49. 23 How can be the web application get configured with the following authorization ruleso Anonymous users must not be allowed to access the application.o All persons except David and John must be allowed to access the application.Answer:authorizationdeny users = “applicationname\David, applicationname\John”deny users = “?”allow users =”*”/authorization

Tech Interviews comment by Stephany

50. 24 What will be the output of the following code snippet?using System;class MainClass{static void Main( ){new MainClass().Display( 3.56 );}

private void Display( float anArg ){Console.Write( “{0} {1}”, anArg.GetType(), anArg );}

double Display( double anArg ){Console.Write( “{0} {1}”, anArg.GetType(), anArg );return anArg;}

public decimal Display( decimal anArg ){Console.Write( “{0} {1}”, anArg.GetType(), anArg ); return anArg;}}o System.Single 3.56o System.Float 3.56o System.Double 3.56o System.Decimal 3.56

Page 19: NET WebDev Interview Questions

Answer:System.Double 3.56

Tech Interviews comment by Stephany

51. 25 What will be output for the given code?Dim I as integer = 5DoI = I + 2Response.Write (I & \” \”)Loop Until I > 10o 5 8o 5 7 9o 7 9 11o Errors outAnswer:7 9 11 (if corrected)

Tech Interviews comment by Stephany

52. 13.A valid comment block in ASP.NET is

Ans. C

Tech Interviews comment by Shivraj

53. 1. what is the differece between c++ &java?2.difference between .net & java

Tech Interviews comment by mridhu

54. Explore hiring practices of: Infosys, Accenture, Caritor, Cognizant, Wipro, Satyam, Kanbay, Oracle, Tata Infotech, Verizon, CTS, Virtusa, TCS, Sasken Communication, Microsoft, HCL, Mindtree Consulting, IBM, Larsen & Toubro, Siemens, Patni, ICICI Bank, Covansys, Hexaware, D. E. Shaw India Software, Mascot Systems, Sonata Software, Hewlett Packard, TCGIvega, Syntel

55. Some book recommendations:

Technical Interview Questions comment policy:

Page 20: NET WebDev Interview Questions