Sunday, May 17, 2015

ASP.NET Interview Question

ASP.NET Interview Questions


1. When using an implicitly typed array, which of the following is most appropriate? 

a. All elements in the initializer list must be of the same type.
b. All elements in the initializer list must be implicitly convertible to a known type which is the actual type of at least one member in the initializer list.
c. All elements in the initializer list must be implicitly convertible to common type which is a base type of the items actually in the list.
Answer: C


2. The output generated by the following code will be:
String t = @”This\Is\a\Test”;
Response.Write(t);

a. ThisIsaTest
b. This\Is\a\Test
c. It will give a compilation error: Unrecognized escape sequence.
Answer: B 


3. Which of the following is/are true regarding validation in an ASP.NET application
 

a. Server validation can be used alongside with client side validation.
b. All data posted on Server, should be validated.
c. Client Side validation typically provides a faster response (feedback) time than server validation.
Answer: C 


4. Which of the following are true about System.Security.Cryptography under version 3.5 of the framework?
 

a. Support is provided for the ‘Suite B’ set of cryptographic algorithms as specified by the National Security Agency (NSA).
b. Cryptography Next Generation (CNG) classes are supported on XP and Vista systems.
c. The System.Security.AesManaged class allows custom block size, iteration counts and feedback modes to support any Rjindael based encryptio
Answer: B 


5. The rights to which Windows Account does anonymous Web Site access use by default?
 

a. Administrator
b. IUSER_MachineName (where the MachineName is the actual computer name)
c. ASPNET
d. Guest
Answer: B 


6. Which of the following statements do Expression Trees fit best?
 

a. Expression trees are a data structure which can be initially composed using language syntax.
b. Expression trees are a dynamically generated code which is executed to perform the desired function.
c. Expression trees can be modified once they are created.
Answer: A 


7. Which of the following are true about Extension methods?
 

a. They must be declared static
b. They can be declared either static or instance members
c. They must be declares in the same assembly(but may be in different sources files)
d. Extension methods can be used to override existing instance methods
e. Extension methods with the same signature for the same class may be declared in multiple namespace without causing compilation errors
Answer: A,C


8. With which class is the task of mapping a specific point in time into units such as weeks, months, and years accoumplished?
 

a. System.Globalization.CultureInfo
b. System.Globalization.Calendar
c. System.DateTime
Answer: A


9. Which of the following are true regarding System.Web.Mail and System.Net.Mail namespaces?
 

a. System.Web.Mail is not supported under version 3.5 of the Framework
b. System.Web.Mail is deprecated under version 3.5 of the Framwork, and it is officially recommended that System.Net.Mail be used.
c. System.Web.Mail is the preferred solution when using IIS hosted applications
d. There are no functional differences; the items were moved to a new namespace to better reflect their applicability.
Answer: B


10. Which of the following is true about Extension methods.
 

a. They can be declared either static or instance members.
b. They must be declared in the same assembly (but may be in different source files)
c. Extension methods can be used to override existing instance methods
d. Extension methods with the same signature for the same class may be declared in multiple namespaces without causing compilation errors.
Answer: A


11. When using Cascading Style Sheets (CSS) to format output, which of the following is/are true?
 

a. Styles can be applied to all elements having the same CSS Class attribute.
b. Styles can be applied to specific elements based on their ID attribute.
c. Styles can be applied to elements based on their position in a hierarchy.
d. Styles can be used to invoke script based code.
e. All of the above
Answer: A


12. Which of the following events should be used for assigning a Theme dynamically to a page?
 

a. PreInit
b. Init
c. PreLoad
d. PreRender
e. Render
Answer: A

13. Which of the following are true about Nullable types? 
a. A Nullable type is a reference type.
b. An implicit conversion exists from any non-nullable value type to a nullable form of that type.
c. A predefined conversion from the nullable type S? to the nullable T? exists if there a predefined conversion from the non-nullable type T
Answer: B,C


14. Given the code below, which items will cause a compilation error?
static void F1(params int[] y)
{
}
static void Sample()
{
int[] j = new Int32[3];
List k = new List();
// ANSWER GOES HERE
}

a. F1(j)
b. F1(k)
c. F1(1,2,3)
d. F1(NEW [] {1,2,3})
e. None of the above
Answer: E

15. Which of the following types guarantee atomic reads and writes? 

a. int
b. double
c. long
d. float
Answer: A,D


16. In order to enable AJAX Functionality, which control is place on the page?
 

a. asp:ScriptManager
b. asp:AjaxManager
c. asp:PageManager
d. asp:ClientScriptManager
Answer: A


17. Determining the availablity of sufficient memory for an operation can be accompished by
 

a. There is no supported application level means to determine if a specfic amount of memory is available
b. Using static methods of system.runtime.memoryfailpoint and checking the return value
c. Creating an instance of system.runtime.memoryfailpoint and monitoring for an insuffcientMemoryException
d. Creating an instance of system.runtime.memoryfailpoint and monitoring for an outofmemoryException
Answer: C


18. In which file are Predefined Client Side Validation Scripts defined?

a. WebUIValidation.js
b. ClientValidation.js
c. AspNetValidation.js
d. UserValidation.js
Answer: A 


19. When using an automatic property, which of the following statements is true?
 

a. The compiler generates a backing field that is completely inaccessible from the application code.
b. The compiler generates a backing field that is accessible via reflection.
c. The compiler generates a code that will store the information separately from the instance to ensure its security.
Answer: A

20. When using asynchronous partial updates with an UpdatePanel, which of the following are true? 

a. Only the UpdatePanel and any child controls go through the server lifecycle.
b. The entire page always goes through the entire lifecycle.
c. Only the UpdatePanel which initiated the Postback and its child controls can provide updated information.
d. UpdatePanels cannot be used with Master Pages.
Answer: A

21. Which of the following attributes of the ProcessModel element of the Machine.Config file, is used to specify the level of authentication for DCOM security? 

a. comAuthenticationLevel
b. comImpersonationLevel
c. maxloThreads
d. requestQueueLimit
Answer: A


22. Which of the following is/are true regarding the use of Authentication to controls access to the HTML file (.htm or .html)?
 

a. ASP.NET authentication handles these by default in a manner equivalent to .aspx pages.
b. ASP.NET authentication can be associated with these extensions using aspnet_isapi.dll in IIS 6.0, for the appropriate directory.
c. ASP.NET authentication cannot be used for this purpose.
Answer: B 


23. By which of the following can the .NET class methods be included in .aspx files?
 a. Including .NET code within the script element with the runat attribute set to server
b. Including .NET code within the code element
c. Including .NET code using the @code directive on the page
d. Including .NET code within the execute attribute of the individual control
Answer: A


24. Where should information about a control created at design time be stored?
 

a. ApplicationState
b. SessionState
c. ViewState
d. None of the above
Answer: C 


25. Which of the following can be used to control caching within an ASP.NET application?
 

a. Using the @OutputCache in the .aspx file
b. Setting the HttpCachePolicy of the Cache property inside the Response object.
c. Using the Cache property of the Page Object
d. All of the above
Answer: D

 26. Which of the following are true using ADO.NET DataSets and DataTables?

a. The DataSets and DataTables objects requires continuous connection to the database
b. All tables a dataset must come from the same database
c. A given instance of a DataTable can be in only one DataSet
d. Content from multiple DataSets can easily be combined into a single DataSet that contains the net result of all changes.
Answer: D 


27. When Windows Communication Foundation is used to develop a Web Service, which of the following are supported?
 

a. WS-Address
b. WS-MetadataExchange
c. WS-Security
d. WS-Atomic Transaction
e. All of the above
Answer: E 


29. The earliest event in which all viewstate information has been restored is:

a. Init
b. PreLoad
c. Load
d. Render
Answer: A 


30. Which of the following items are recommended when using XML comments to generate documentation?

a. <exception>
b. <code>
c. <summary>
d. All of the above
Answer: D 


31. Which of the following conditions can trigger the automatic recycling of an ASP.NET applications hosted in IIS?

a. A specific number of requests to the application process
b. A percentage of physical memory utilized by the process
c. A specific time interval
d. All of the above
Answer: C 


32. Which of the following is not an unboxing conversion?

a. void func1(object o)
{
int i = (int)o;
}

b. void func1(ValueType v)
{
int i = (int)v;
}

c. enum En {e1, e2}
void func1(System.Enum et)
{
En e = (En) et;
}

d. interface I {int Value {get; set;}}
void func1(I vt)
{
int i = vt.Value;
}

e. class C { public int Value {get; set;}}
void func1(C vt)
{
int i = vt.Value;
}
Answer: D

33. Which of the following are required to be true by objects which are going to be used as key in a system.collection.hashtable? 

a. They must handle case –sensitive identically in both the Gethashcode() and equals() method
b. key objects must be immutable for the duration they are used with hash table
c. getHashCode() must be overridden to provide the same result given the same parameters ,regardless of reference equality unless the Hash table constructor is provided with an IEqualityComparer parameter
d. Each element in hash table is stored as a keyvalue pair of the type system. Collection .dictionary element
e. All of the above
Answer: E

34. The following are two statements related to System.DateTimeOffset namespace.
Statement X: DateTimeOffset values can be converted to DateTime values and vice versa.
Statement Y: DateTimeOffset does not support arithmetical operations
 

a. Statement X is incorrect and Statement Y is correct
b. Statement X is correct and Statement Y is incorrect
c. Both Statements X,Y are correct
d. Both Statements X,Y are incorrect
Answer: B 

35. Which of the following is false regarding System.Threading.ReaderWriterLockSlim? 
a. It is optimized for single processor/core operations
b. A thread which has a read lock on a resource may not acquire a write lock on the same resource.
c. By default, a thread which has a read lock on a resource and attempts to get another read lock on the same resource will throw an exception
Answer: C 


36. The following are the two statements regarding the DataRow from the DataRowCollection of a DataTable
Statement X: Use the DataRowCollection.Remove method to immediately delete the row.
Statemnt Y: Use the DataRow.Delete method to mark the row for deletion when DataRow.AcceptChanges is called.
 

a. Statement X is incorrect and Statement Y is correct
b. Statement X is correct and Statement Y is incorrect
c. Both Statements X,Y are correct
d. Both Statements X,Y are incorrect
Answer: C 

37. Which of the following is true about C# generics?
a. C# allows non-type template parameters
b. C# supports explicit specialization
c. C# allows the type parameter to be used as the base class for the generic type.
d. C# enforces that all codes are valid for all types of parameters.
Answer: D 

38. Which of the following accurately describes the class structure when implementing an Asp.Net page which used the codefile attribute?
a. The actual instantiated class is the class defined in the codefile.
b. The actual instantiated class is dynamically created and has a base class defined in the codefile.
c. The actual instantiated class is dynamically created and has a member representing the class defined in the codefile.
d. The actual instantiated class is dynamically creates and is a co-class of the class defined in the CodeFile.
Answer: D 

39. Which of the following are included in the advantages of Lambda Expressions over Anonymous methods?
a.More concise syntax.
b.The types for a Lambda Excpression may be omitted.
c.The body of an Anonymous method can not be an expression.
d.Lambda Expressions permit deferred type inference that anonymous methods do not
e.All of the above.
Answer: A 

40. Which of the following statements is false about Passport Authentication?
a. The Passport SDK must be installed.
b.Passport authentication requires a network path between the Client and the Microsoft Passport Server
c.Passport Authentication provides persistent authentication across sessions
Answer: B

No comments:

Post a Comment