Set - 8

Question 1 :

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

Answer :

Integer, String and Date

Question 2 :

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.

Answer :

Convert.ToInt32 can handle null value but int.Parse throws ArgumentNullException error.

Question 3 :

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

Answer :


Question 4 :

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

Answer :


Question 5 :

A set of tables are maintained in a Dataset as
* TablesCollection object
* DataTableCollection object
* DataRowsCollection object
* TableRowCollection object

Answer :

TablesCollection object

Question 6 :

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

Answer :

System.Data, System.Data.OleDb or System.Data.SQL

Question 7 :

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

Answer :


Question 8 :

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"

Answer :

AllowSorting = "true" and AllowPaging = "true"

Question 9 :

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

Answer :


Question 10 :

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

Answer :

<%# property or collection #%>

Question 11 :

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

Answer :


Question 12 :

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

Answer :

A DataSet can be synchronised with a RecordSet.

Question 13 :

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

Answer :

using aliasName = System.Data.OracleClient;

Question 14 :

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

Answer :


Question 15 :

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

Answer :


Question 16 :

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)

Answer :

objXslT.Transform(objNav, nothing)

Question 17 :

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

Answer :

csc /doc:NewHome.xml NewHome.cs

Question 18 :

What is the comment syntax for C#'s XML-based documentation? * /** and **/ * //# * /// * //*

Answer :


Question 19 :

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

Answer :


Question 20 :

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

Answer :


Question 21 :

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

Answer :


Question 22 :

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()
* Asynchroize()

Answer :


Question 23 :

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

Answer :

AutoPostBack attribute is set to False

Question 24 :

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

Answer :

The Render() method

Question 25 :

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

Answer :

Regular Expression.

Question 26 :

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

Answer :


Question 27 :

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

Answer :

<% - - Comment - - %>

Question 28 :

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 ,

Answer :

Application Start and End

Question 29 :

A Few of the Namespaces that get imported by default in an ASPX file are
* System, System.Data, System.Drawing,
* System,
System.IO, System.Management, System.Globalization
* System, System.Collections,
System.Text, System.Web
* System,
System.Reflection, System.Web

Answer :

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

Question 30 :

The Assemblies that can be referenced in an ASPX file without using @Assembly Directive is
* System.dll, System.Data.dll,
System.Web.dll, System.Xml.dll,
* System.dll,
System.Collections.dll, System.IO.dll
* System.dll, System.Reflection.dll,
* System.Drawing.dll, System.Assembly.dll,

Answer :

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

Question 31 :

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

Answer :

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

Question 32 :

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

Answer :

writing an HTTP module-a Class that implements IhttpModule and registering it in Web.Config

Question 33 :

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

Answer :

@ OutputCache

Question 34 :

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=" sqlConnectionString=" data source=;user id=sa;password="cookieless="false" timeout="30" />
* <SessionState mode="OutProc" stateConnectionString="tcpip=" sqlConnectionString="data source=;user id=sa;password=" cookieless="false" timeout="30" />
* <SessionState mode="stateserver" stateConnectionString="tcpip=" sqlConnectionString="data source=;user id=sa;password=" cookieless="false" timeout="30" />

Answer :

SessionState mode="stateserver" stateConnectionString="tcpip= sqlConnectionString="data source=;user id=sa;password=" cookieless="false" timeout="30?

Question 35 :

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

Answer :


Question 36 :

How can be the web application get configured with the following authorization rules
* Anonymous users must not be allowed to access the application.
* All persons except David and John must be allowed to access the application.
o <authorization><allow roles ="*"><deny roles = "?"><</authorization>
o <authorization><deny users = "applicationname\David; applicationname\John" ><deny users = "*"></authorization>
o <authorization><deny users = "applicationname\David, applicationname\John" ><deny users = "?"><allow users ="*"></authorization>
o <authorization><allow users ="*"><deny users = "applicationname\David, applicationname\John" ></authorization>

Answer :

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

Question 37 :

Describe the advantages of writing a managed code application instead of unmanaged one. What's involved in certain piece of code being managed?

Answer :

The advantages include automatic garbage collection, memory management, support for versioning and security. These advantages are provided through .NET FCL and CLR, while with the unmanaged code similar capabilities had to be implemented through third-party libraries or as a part of the application itself.

Question 38 :

Are COM objects managed or unmanaged?

Answer :

Since COM objects were written before .NET, apparently they are unmanaged.
Any code not written in the Microsoft .NET framework environment is UNMANAGED. So naturally COM+ is unmanaged because it is written in Visual Basic 6.

Question 39 :

So can a COM object talk to a .NET object?

Answer :

Yes, through Runtime Callable Wrapper (RCW) or PInvoke.

Question 40 :

How do you generate an RCW from a COM object?

Answer :

Use the Type Library Import utility shipped with SDK. tlbimp COMobject.dll /out:.NETobject.dll or reference the COM library from Visual Studio in your project.

Question 41 :

I can't import the COM object that I have on my machine. Did you write that object?

Answer :

You can only import your own objects. If you need to use a COM component from another developer, you should obtain a Primary Interop Assembly (PIA) from whoever authored the original object.

The answer to (5) is only partially correct. You *can* import COM objects, even if they are not your own. It is recommended that you obtain the Primary Interop from the vendor, but not required. The most common problem importing a COM DLL is that it exposes objects that form part of a separate COM DLL. You can generate interops for these additional DLLs, and then refer to them when importing the problem DLL.

Question 42 :

How do you call unmanaged methods from your .NET code through PInvoke?

Answer :

Supply a DllImport attribute. Declare the methods in your .NET code as static extern. Do not implement the methods as they are implemented in your unmanaged code, you're just providing declarations for method signatures.

Question 43 :

Can you retrieve complex data types like structs from the PInvoke calls?

Answer :

Yes, just make sure you re-declare that struct, so that managed code knows what to do with it.

Question 44 :

I want to expose my .NET objects to COM objects. Is that possible?

Answer :

Yes, but few things should be considered first. Classes should implement interfaces explicitly. Managed types must be public. Methods, properties, fields, and events that are exposed to COM must be public. Types must have a public default constructor with no arguments to be activated from COM. Types cannot be abstract.

Question 45 :

Can you inherit a COM class in a .NET application?

Answer :

The .NET Framework extends the COM model for reusability by adding implementation inheritance. Managed types can derive directly or indirectly from a COM coclass; more specifically, they can derive from the runtime callable wrapper generated by the runtime. The derived type can expose all the method and properties of the COM object as well as methods and properties implemented in managed code. The resulting object is partly implemented in managed code and partly implemented in unmanaged code.

Question 46 :

Suppose I call a COM object from a .NET application, but COM object throws an error. What happens on the .NET end?

Answer :

COM methods report errors by returning HRESULTs; .NET methods report them by throwing exceptions. The runtime handles the transition between the two. Each exception class in the .NET Framework maps to an HRESULT.

Question 47 :

What do you know about .NET assemblies?

Answer :

Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET Remoting applications.

Question 48 :

What's the difference between private and shared assembly?

Answer :

Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.

Question 49 :

What's a strong name?

Answer :

A strong name includes the name of the assembly, version number, culture identity, and a public key token.

Question 50 :

How can you tell the application to look for assemblies at the locations other than its own install?

Answer :

Use the
directive in the XML .config file for a given application.

<probing privatePath="c:\mylibs; bin\debug" /> 
should do the trick. Or you can add additional search paths in the Properties box of the deployed application.