ASP.Net 3.5 using C# Test Answers



1. Which of the following does using Initializer Syntax with a collection as shown below require?

CollectionClass<int> numbers = new CollectionClass<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Answers:
• Collection Class must implement System.Collections.Generic.ICollection<T>
• Collection Class must implement System.Collections.Generic.IList<T>
• Each of the Items in the Initializer List will be passed to the Add<T>(T item) method

2. Which of the following types guarantee atomic reads and writes?
Answers:
• int
• double
• long
• float
3. Which of the following accurately describes the class structure when implementing an ASP.Net page which uses the CodeFile attribute?
Answers:
• The actual instantiated class is dynamically created and has a base class defined in the CodeFile.
• The actual instantiated class is dynamically created and has a member representing the class defined in the CodeFile.
• The actual instantiated class is dynamically created and is a co-class of the class defined in the CodeFile.
4. Which of the following does Event Bubbling allow composite controls to perform?
Answers:
• Propagate container related events to the child controls.
• Propagate child events up to control hierarchy
• Distribute events between peer child controls.
• Translate control unhandled control events into exceptions.
5. With which of the following are Declarative Databinding expressions delimited?
Answers:
• <%# %>
• <%-- --%>
• <!-- -->
• <# >
6. Which of the following are true of using ADO.NET DataSets and DataTables?
Answers:
• The DataSets and DataTables objects requires continuous connection to the database
• All tables in a dataset must come from the same database
• A given instance of a DataTable can be in only one DataSet
• Content from multiple DataSets can easily be combined into a single DataSet that contains the net result of all changes
7. Which of the following controls allows the use of XSL to transform XML content into formatted content?
Answers:
• System.Web.UI.WebControls.Xml
• System.Web.UI.WebControls.Xslt
• System.Web.UI.WebControls.Substitution
• System.Web.UI.WebControls.Transform
8. 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.
Statement Y: Use the DataRow.Delete method to mark the row for deletion when DataRow.AcceptChanges is called.
Answers:
• Statement X is correct and Statement Y is incorrect
• Statement X is incorrect and Statement Y is correct
• Both Statements X, Y are correct
• Both Statements X, Y are incorrect
9. Which of the following can be used to preserve application state information?
Answers:
• ApplicationState
• SessionState
• ViewState
• All of the above
10. When using asynchronous partial updates with an UpdatePanel, which of the following are true?
Answers:
• Only the UpdatePanel and any child controls go through the server lifecycle.
• The entire page always goes through the entire lifecycle.
• Only the UpdatePanel which initiated the Postback and its child controls can provide updated information.
• UpdatePanels can not be used with Master Pages.
11. Which of the following are required to be true by objects which are going to be used as keys in a System.Collections.HashTable?
Answers:
• They must handle case-sensitivity identically in both the GetHashCode() and Equals() methods.
• Key objects must be immutable for the duration they are used within a HashTable.
• Get HashCode() must be overridden to provide the same result, given the same parameters, regardless of reference equality unless the HashTable constructor is provided with an IEqualityComparer parameter.
• Each Element in a HashTable is stored as a Key/Value pair of the type System.Collections.DictionaryElement
• All of the above
12. Which of the following are true regarding the System.Collections.Generic.HashSet<T> class?
Answers:
• HashSet is an unordered collection.
• The default EqualityComparer checks whether the element supplied to the HashSet is unique or not.
• HashSet provides functionality for "conceptual sets" where the rules for membership can be specified without actually creating all of the items.
13. Which of the following is not a characteristic, that a Query expression should have?
Answers:
• It must contain a from clause
• It must begin with a select clause
• It can end with a group clause
14. Which of the following is false about declarative attributes?
Answers:
• They must be inherited from the System.Attribute.
• Attribute classes may be restricted to be applied only to application element types.
• By default, a given attribute may be applied multiple times to the same application element.
15. When using a JavaScript timer control in conjunction with UpdatePanels, which of the following statements are true?
Answers:
• The interval will never restart before the page postback is complete.
• The timer control must be located outside of the UpdatePanel
• If the timer expiration triggers a postback while a previous postback is in progress, the first postback is canceled.
• The timer must always be specified as a trigger for the updatepanel which is to be update when the interval expires.
16. What is the proper declaration of a method which will handle the following event?

Class MyClass
{
      public event EventHandler<MyArgs> MyEvent;
}
Answers:
• public void A_MyEvent(object sender, MyArgs e) { }
• public void A_MyEvent(object sender, EventArgs e) { }
• public void A_MyEvent(MyArgs e) { }
17. Which of the following is/are applicable while using Secure Socket Level communications?
Answers:
• A certificate must be installed on the server.
• The certificate must match the web address to prevent a browser warning or error
• The certificate must be issued by an authority recognized by the client computer to prevent a browser warning or error
• All of the above
18. Which of the following is false about System.GC under version 3.5 of the .NET Framework?
Answers:
• You can request that the garbage collector processes a generation if it determines that it is appropriate at specific points in your code
• You can control the intrusiveness of the garbage collector (how often it performs collections) while your program is running
• You can control the intrusiveness of the garbage collector (how often it performs collections) only during application initialization
19. Where should an instance of an object which provides services to all users be stored?
Answers:
• ApplicationState
• SessionState
• ViewState
• None of the above
20. When using an automatic property, which of the following statements is true?
Answers:
• The compiler generates a backing field that is completely inaccessible from the application code.
• The compiler generates a backing field that is accessible via reflection.
• The compiler generates a code that will store the information separately from the instance to ensure its security.
21. The output generated by the following code will be:

string t = @"This\Is\a\Test";
Response.Write(t);
Answers:
• ThisIsaTest
• This\Is\a\Test
• It will give a compilation error: Unrecognized escape sequence
22. Which of the following statements are applicable in LINQ to SQL?
Answers:
• It is pure Object Relational (O/R) model.
• It is a set of enhancements to the DataSet and DataTable classes.
• It requires the use of SQLServer as the database.
• Because LINQ is based on Queries, it can not be used to modify the data in the database.
23. 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?
Answers:
• comAuthenticationLevel
• comImpersonationLevel
• maxIoThreads
• requestQueueLimit
24. With which class is the task of mapping a specific point in time into units such as weeks, months, and years accomplished?
Answers:
• System.Globalization.CultureInfo
• System.Globalization.Calendar
• System.DateTime
25. Which of the following are common methods of supplying "Help" information to an ASP.NET application?
Answers:
• Setting the ToolTip property of a control to a string containing the information.
• using the open method of the browser window object to open a new browser window and display a help related ASP.NET page
• Using the showHelp method of the browser window object to display a topic from a compiled help file (.chm).
• All of the above
26. By which of the following can the .NET class methods be included in .aspx files?
Answers:
• Including .Net code within the script element with the runat attribute set to server
• Including .Net code within the code element
• Including .Net code using the @code directive on the page
• Including .Net code within the execute attribute of the individual control
27. Which of the following is not an unboxing conversion?
Answers:
• void Sample1(object o) { int i = (int)o; }
• void Sample1(ValueType vt) { int i = (int)vt; }
• enum E { Hello, World} void Sample1(System.Enum et) { E e = (E) et; }
• class C { public int Value { get; set; } } void Sample1(C vt) { int i = vt.Value; }
28. Which of the following can be used to control caching within an ASP.NET application?
Answers:
• Using the @OutputCache directive in the .aspx file.
• Setting the HttpCachePolicy of the Cache property inside the Response object.
• Using the Cache property of the Page Object.
• All of the above
29. What will be the impact of using implicitly typed local variables as in the following example?

var sample = "Hello World";
Answers:
• The actual type is determined at compilation time, and has no impact on the runtime
• The actual type is determined at runtime, and late binding takes effect
• "var" itself is a specific type defined by the framework, and no special binding takes place
30. The earliest event in which all viewstate information has been restored is:
Answers:
• Init
• PreLoad
• Load
• Render
31. Which of the following items are recommended when using XML comments to generate documentation?
Answers:
• <exception>
• <code>
• <summary>
• All of the above
32. Which of the following conditions can trigger the automatic recycling of an ASP.NET application hosted in IIS?
Answers:
• A specific number of requests to the application process.
• A percentage of physical memory utilized by the process.
• A specific time interval
• All of the above
33. To which of the following do automatic properties refer?
Answers:
• You declare (explicitly or implicitly) the accessibility of the property and get and set accessors, but do not provide any implementation or backing field
• You attribute a member field so that the compiler will generate get and set accessors
• The compiler creates properties for your class based on class level attributes
• They are properties which are automatically invoked as part of the object construction process
34. Which of the following are true regarding System.Web.Mail and System.Net.Mail namespaces?
Answers:
• System.Web.Mail is not supported under version 3.5 of the Framework
• System.Web.Mail is deprecated under version 3.5 of the Framework, and it is officially recommended that System.Net.Mail be used.
• System.Web.Mail is the preferred solution when using IIS hosted applications
• There are no functional differences; the items were moved to a new namespace to better reflect their applicability
35. Which of the following differentiates a UserControl from a Custom Server control?
Answers:
• UserControl can directly express rendering information via markup; a Custom Server control can not.
• UserControl does not require the use of the @Register directive; a Custom Server control does require it.
• UserControl can make use of script based validation; a Custom Server control can not.
• UserControl can represent complete compositate hierarchy; a Custom Server control can not.
36. Which of the following is/are true regarding validation in an ASP.NET application?
Answers:
• Server validation can be used alongside with client side validation.
• All data posted on Server, should be validated.
• Client Side validation typically provides a faster response (feedback) time than server validation.
• All of the above
37. When using Cascading Style Sheets (CSS) to format output, which of the following is/are true?
Answers:
• Styles can be applied to all elements having the same CSS Class attribute
• Styles can be applied to specific elements based on their ID attribute
• Styles can be applied to elements based on their position in a hierarchy
• Styles can be used to invoke script based code
• All of the above
38. 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 supports arithmetical operations
Answers:
• Statement X is incorrect and Statement Y is correct
• Statement X is correct and Statement Y is incorrect
• Both Statements X, Y are correct
• Both Statements X, Y are incorrect
39. Which of the following statements is false about Passport Authentication?
Answers:
• The Passport SDK must be installed.
• Passport authentication requires a network path between the Client and the Microsoft Passport Server
• Passport Authentication provides persistent authentication across sessions
40. When using a DataReader to access the results of a Database operation, which of the following is true?
Answers:
• The DataReader provides a cursor that can be used to move forward and backwards through the result.
• The DataReader provides random access capabilities on the result.
• The DataReader can provide the Schema information of the result to the application code.
41. In which file are Predefined Client Side Validation Scripts defined?
Answers:
• WebUIValidation.js
• ClientValidation.js
• AspNetValidation.js
• USerValidation.js
42. Which directive allows the utilization of  a custom web control in an ASP.NET page?
Answers:
• @Register
• @Include
• @Control
• @Import
43. Which of the following are true about System.Security.Cryptography under version 3.5 of the framework?
Answers:
• Support is provided for the "Suite B" set of cryptographic algorithms as specified by the National Security Agency (NSA).
• Cryptography Next Generation (CNG) classes are supported on XP and Vista systems.
• The System.Security.Cryptography.AesManaged class allows custom block size, iteration counts and feedback modes to support any Rijndael based encryption.
44. In order to enable AJAX Functionality, which control is placed on the page?
Answers:
• asp:ScriptManager
• asp:AjaxManager
• asp:PageManager
• asp:ClientScriptManager
45. Determining the availability of sufficient memory for an operation can be accomplished by:
Answers:
• creating an instance of System.Runtime.MemoryFailPoint and monitoring for an InsufficientMemoryException
• creating an instance of System.Runtime.MemoryFailPoint and monitoring for an OutOfMemoryException
• There is no supported application level means to determine if a specific amount of memory is available.
46. Custom non-fatal exceptions should be derived from:
Answers:
• ApplicationException
• DataMisalignedException
• ExecutionEngineException
• SystemException
47. Which of the following events should be used for assigning a Theme dynamically to a page?
Answers:
• PreInit
• Init
• PreLoad
• PreRender
• Render
48. Which of the following are performed to fully debug an ASP.NET Application running on the same machine as the debugger?
Answers:
• Enabling debug information in the .NET Assembly
• Setting the debug attribute of the compilation element to true in the web.config file.
• Enabling ASP.NET debugging in the IIS metabase.
49. Which of the following is true about C# generics?
Answers:
• C# allows non-type template parameters
• C# supports explicit specialization
• C# allows the type parameter to be used as the base class for the generic type
• C# enforces that all codes are valid for all types of parameters
50. Which of the following are the goals of the Windows Communciation Foundation?
Answers:
• Bringing various existing communication technologies into a unified environment.
• Cross vendor/platform communication.
• Support for asynchronous communications.
• Support for distributed applications based on technologies such as MSMQ and/or COM+
• All of the above
51. The rights of which Windows Account does anonymous Web Site access use by default?
Answers:
• Administrator
• IUSER_MachineName (where the MachineName is the actual computer name)
• ASPNET
• Guest
52. Which of the following can one use to detect the user's current language?
Answers:
• Examining the UserLanguages property of the current Request object.
• Examining the CurrentCulture property of the current Request object.
• Examining the Language property of the current Page object.
53. Which of the following are included in the advantages of Lambda Expressions over Anonymous methods?
Answers:
• More concise syntax
• The types for a Lambda Expression may be omitted
• The body of an Anonymous method can not be an expression
• Lambda Expressions permit deferred type inference, that anonymous methods do not
• All of the above
54. Which of the following is/are true regarding the use of Authentication to control access to the HTML file (.htm or .html)?
Answers:
• ASP.NET authentication handles these by default in a manner equivalent to .aspx pages
• ASP.NET authentication can be associated with these extensions using aspnet_isapi.dll in IIS 6.0, for the appropriate directory
• ASP.NET authentication cannot be used for this purpose
55. Which of the following are true about Nullable types?
Answers:
• A Nullable type is a reference type.
• An implicit conversion exists from any non-nullable value type to a nullable form of that type.
• A predefined conversion from the nullable type S? to the nullable type T? exists if there is a predefined conversion from the non-nullable type S to the non-nullable type T
56. The default number of threads per processor in the System.Threading.ThreadPool class under version 3.5 of the Framwork is:
Answers:
• 1
• 25
• 250
• 100
• 500
57. Where should information about a control created at design time be stored?
Answers:
• ApplicationState
• SessionState
• ViewState
• None of the above
58. 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
}
Answers:
• F1(j);
• F1(k);
• F1(1, 2, 3);
• F1(new [] {1,2,3})
• None of the above
59. In which of the following events, the final changes to the contents of the page or its controls could be made.
Answers:
• Load
• LoadComplete
• PreRender
• Init
60. Which of the following is used to remove a cookie from a client machine?
Answers:
• Remove the cookie from the System.Web.UI.Page.Request.Cookies collection.
• Remove the cookie from the System.Web.UI.Page.Request.Browser.Cookies collection.
• Set the Expires property to DateTime.Now for a cookie in the Web.UI.Page.Response.Cookies
• Remove the cookie from the System.Web.UI.Page.Response.Cookies collection.
61. When Windows Communication Foundation is used to develop a Web Service, which of the following are supported?
Answers:
• WS-Addressing
• WS-MetadataExchange
• WS-Security
• WS-Atomic Transaction
• All of the above
62. To which contract is the SessionMode property to disallow, require, or permit applied when Windows Communication Foundation is used?
Answers:
• ServiceContract
• OperationContract
• DataContract
• MessageContract
63. Via which of the following is ViewState maintained by default?
Answers:
• A hidden variable within the page that is included with each round tip.
• A cookie which resides on the clients computer
• A server side in-process memory cache
• Instance member variables of the Page class
64. Which of the following are true about Extension methods.
Answers:
• They can be declared either static or instance members
• They must be declared in the same assembly (but may be in different source files)
• Extension methods can be used to override existing instance methods
• Extension methods with the same signature for the same class may be declared in multiple namespaces without causing compilation errors
65. In order to use the AJAX AuthenticationService class, which of the following must be true?
Answers:
• It must be enabled in the web.config of the ASP.Net application.
• Forms Authentication must be enabled in the web.config of the ASP.Net Application
• Cookies must be enabled in the browser
• A redirection url must be supplied for successful login.