Friday, January 18, 2008

.NET Web Developer Interview Q&A

  1. Which of the following languages is NOT included in the default .NET Framework installation?

  2. What are the different types of serialization supported in .NET Framework
    • XmlSerializer
    • SoapFormatter
    • XPathNavigator
    • HttpFormatter

  3. The CLR uses which format for assembly version numbers
    • Major:Minor:Revision:Build
    • Major:Build:Minor:Revision
    • Major:Revision:Minor:Build
    • Major:Minor:Build:Revision
    http://www.dotnet247.com/247reference/msgs/45/225355.aspx

  4. What tool is used to manage the GAC?
    • GacMgr.exe
    • GacSvr32.exe
    • GacUtil.exe
    • RegSvr.exe
  5. State True or False: A single .NET dll can contain unlimited classes
    • True
    • False

  6. State True or False: ASP.NET can currently run only on Windows Platform
    • True
    • False

  7. Which one of the following best describes “Type-Safe”
    • It ensures that the data type are safely handled
    • It ensures that types are not mismatched when they are called so uses a typecasting before referencing any data object
    • It ensures that an object only references memory locations that it’s allowed to, preventing data corruption and the accidental misuse of object types
    • All of the above

  8. The number of objects in ASP.NET is
    • 6
    • 7
    • 9
    • 10

  9. The code used to turn off buffering is
    • Buffering = false
    • OutputBuffer = false
    • BufferOutput = false
    • Buffer = Off

  10. Can you have two applications on the same machine one which is using .NET Framework 1.1 and the other using 2.0 ?
    • Yes
    • No
    • Depends on System configuration

  11. Which of the following DOT.NET tools manages certificates, certificate trust lists (CTLs), and certificate revocation lists (CRLs)?
    • sn.exe
    • certnet.exe
    • certmgr.exe
    • gacutil.exe

  12. You need to generate a public/private key pair for using in creating a shared assembly. Given the above scenario, which .NET SDK utility should be used?
    • certmgr.exe
    • gacutil.exe
    • sn.exe
    • resgen.exe

  13. The object that contains all the properties and methods for every ASP.NET page, that is built is
    • Page Object
    • HTTPPage Object
    • WebPage Object
    • System.Web.UI.Page

  14. In C#, which character is used to indicate a verbatim string literal?
    • @
    • !
    • "
    • #

  15. Which of the following operators has the highest precedence?
    • Pre Increment (++x)
    • Shift bits left: <<
    • Bitwise Or: |
    • Post Increment (x++)

  16. The uniqueId that gets generated at the start of the Session is stored in
    • Client computer as a cookie
    • Server machine
    • Passed to and fro on each and every request and response
    • Both a and b are correct

  17. State True or False: C# supports multiple-inheritance
    • True
    • False

  18. Bitwise AND operator in C# is
    • &
    • &&
    • AND
    • XAND

  19. Bitwise OR operator in C# is
    • OR
    • ||
    • |
    • XOR

  20. What’s the .NET datatype that allows the retrieval of data by a unique key?
    • Primary
    • Integer
    • Unique Identifier
    • HashTable

  21. The keyword ‘int’ maps to one of the following .NET types
    • System.Int16
    • System.Int32
    • System.Int64
    • System.Int128

  22. What can be achieved in IL which is not possible in C# ?
    • Creation of an ArrayList
    • Creation of a Dictionary
    • Creation of a two dimensional array
    • Creation of a non-zero based array

  23. Which of the following is the correct code for setting a Session timeout of 30 minutes
    • Session.Timeout = 108000
    • Session.Timeout = 1800
    • Session.Timeout = 300
    • Session.Timeout = 30

  24. The process that ASP.NET uses to keep track of Sessions without cookies is
    • Cookie Munging
    • Cookie Monking
    • Cookie Mocking
    • Cookie Munching

  25. The method that transfers ASP.NET execution to another page, but returns to the original page when it is done is
    • Server.Transfer()
    • Server.Redirect()
    • Server.Execute()
    • Server.Return()

  26. A structure in C# can be derived from one or more
    • class
    • interface
    • both
    • none

  27. State True or False: Static method cannot be overridden
    • True
    • False
    The overridden base method must be virtual, abstract, or override.

  28. The Equivalent HTML Control for the input type="button" tag is
    • HtmlInput
    • HtmlButton
    • HtmlPushButton
    • HtmlInputButton

  29. The Equivalent Html Control for the input type="checkbox" tag is
    • HtmlCheckBox
    • HtmlInputChkBox
    • HtmlInputCheckBox
    • HtmlInputTypeChkBox

  30. Which operator is used for connecting a event with a procedure in C#?
    • +=
    • =
    • both
    • none

  31. State True or False: Events in Web forms are processed before the “Page Load” event
    • True
    • False

  32. What namespaces are necessary to create a localized application?
    • System.Globalization
    • System.Globalization and System.Resources.
    • System.Resources.
    • System.Array

  33. A new server-side control can be created by implementing the class ___________
    • System.Web.WebControl
    • System.Web.UI.WebControl
    • System.Web.UI.WebControls.WebControl
    • Any one of the above

  34. The parameter “clienttarget = downlevel” does one of the following
    • Adds aliases for specific user agents to an internal collection of user agent aliases
    • Indicates the useragents level of validating the controls
    • Disables all DHTML events(including Validation controls)
    • None of the above

  35. The methods in C# can be overloaded in which of the following ways
    • By having the same method name and specifying different number of parameters
    • By giving different method names and same number of parameters
    • By having the same method name and specifying different types of parameters
    • By giving different method names and same types of parameters

  36. The RangeValidator control supports the following datatype
    • Integer and String
    • Integer, Float, String, XMLDatatypes
    • Integer, String and Date
    • Integer, Boolean, Short, String and Date

  37. What is the difference between Convert.ToInt32 and int.Parse?
    • Both are same and both can handle null value.
    • Convert.ToInt32 can handle null value but int.Parse throws ArgumentNullException error.
    • int.Parse can handle null value but Convert.ToInt32 throws ArgumentNullException error.
    • Both Convert.ToInt32 and int.Parse cannot handle null value.

  38. State True or False: Any ODBC-compliant database can be accessed through ASP.NET
    • True
    • False

  39. You need to select a .NET language that has auto-documenting features built into the source code and compiler. Given the scenario above what language compiler should be selected?
    • vbc.exe
    • cl.exe
    • ilasm.exe
    • cs.exe

  40. A set of tables are maintained in a Dataset as
    • TablesCollection object
    • DataTableCollection object
    • DataRowsCollection object
    • TableRowCollection object

  41. The namespaces needed to use data mechanisms in ASP.NET pages are
    • System.Data, System.Data.OleDb or System.Data.SQL
    • System.Data, System.Data.ODBC
    • System.Data, System.Data.DataRow
    • System.Data.DataRowCollection, System.Data.DbType

  42. What are the different methods to access Database in .NET ?
    • OleDB,ODBC,SQLClient
    • OleDB, JDBC, SQLServer
    • ODBC-JDBC, DataSet, SQLClient
    • Datasource, DataSet, DSN

  43. The two properties of a DataGrid that has to be specified to turn on sorting and paging respectively are
    • EnableSorting = “true” and EnablePaging = “true”
    • DisableSorting = “false” and DisablePaging = “false”
    • AllowSorting = “true” and AllowPaging = “true”
    • Sorting = “true” and Paging = “true”

  44. Which one of the following objects is used to create a foreign key between two DataTables?
    • DataRelation
    • DataRelationship
    • DataConstraint
    • DataKey

  45. The Syntax for data-binding expressions is
    • <%# property or collection %>
    • <%# property or collection #%>
    • <%$ property or collection %>
    • <%@ property or collection %>

  46. The method that need to be invoked on the DataAdapter control to load the generated dataset with data is
    • Bind()
    • Fill()
    • FillData()
    • SetData()

  47. Which of the following operations can you NOT perform on an ADO.NET DataSet?
    • A DataSet can be synchronised with the database.
    • A DataSet can be synchronised with a RecordSet.
    • A DataSet can be converted to XML.
    • You can infer the schema from a DataSet

  48. Which is the correct statement to set the alias name for namespace in C#?
    • using System Data.OracleClient = aliasName;
    • using aliasName = System.Data.OracleClient;
    • string aliasName = using.System.Data.OracleClient;
    • Both a & b

  49. The property that indicates whether existing database constraints should be observed when performing updates
    • EnforceConstraints
    • Constraints
    • GetConstraints
    • ConstraintsEnforce

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

  51. The data from an XSL Transform with XmlReader can be returned in one of the following ways
    • objReader = objXslT.Transform(objNav, nothing)
    • objXslT.Transform(objNav, nothing)
    • objReader = objXslT.Transform(objNav, nothing, objWriter)
    • objXslT.Transform(objNav, nothing, objWriter)

  52. Pick the command line that would result in the C# compiler generating an XML documentation file
    • csc /doc:NewHome.xml NewHome.cs
    • c /doc /docfile: NewHome.xml NewHome.cs
    • csc /doc /out: NewHome.xml NewHome.cs
    • csc /xml NewHome.cs

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

  54. 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?
    • AssemblyInfo.xml
    • AssemblyInfo.cs
    • AssemblyInformation.cs
    • AssemblyAttributes.cs

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

  56. What is the exception that is thrown when there is an attempt to dynamically access a method that does not exist?
    • MissingMethodException
    • TypeLoadException
    • MethodLoadException
    • MethodAccessException

  57. What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time?
    • Synchronize()
    • Lock() and UnLock()
    • Lock() - so that multiple user can not acces your application
    • Asynchroize()

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

  59. What method must be overridden in a custom control?
    • The Paint() method
    • The Control_Build() method
    • The Render() method
    • The default constructor

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

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

  62. The event handlers that can be included in the Global.asax file are
    • Application Start and Session Start event handlers only
    • Application End and Session End event handlers only
    • Per-request and Non-deterministic event handlers only
    • Application Start and End, Session Start and End, Per-request and Non-deterministic event handlers

  63. A Few of the Namespaces that get imported by default in an ASPX file are
  64. The Assemblies that can be referenced in an ASPX file without using @Assembly Directive is

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

  66. 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 (System.IndexOutOfRangeException)
    • Hello C# world
    • None of the above

  67. 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 above

  68. The ASP.NET directive that lets you cache different versions of a page based on varying input parameters, HTTP headers and browser type is
    • @OutputCache
    • @CacheOutput
    • @PageCache
    • @CacheAll

  69. 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?
    • <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" />
    • <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" />
    • <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" />

  70. What is the output for the below mentioned compilation command>csc /addmodule:A.Exe B.Cs
    • A.exe
    • B.exe
    • A.dll
    • B.dll

  71. 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;
    }
    }

  72. What will be output for the given code?
    Dim I as integer = 5
    Do
    I = I + 2
    Response.Write (I & " ")
    Loop Until I > 10
    • 5 8
    • 5 7 9
    • 7 9 11
    • Errors out