ASP.Net 3.5 using VB Test Answers

1. Which of the following mechanisms are not suitable for returning a single row from a DataTable containing a large number of records?
Answers:
• DataTable.Rows.Find
• DataTable.Rows.Select
• DataTable.Select
• Enumerating across DataTable.Rows

2. Given the following code, which of the following are syntactically correct?

    <Extension()> _
    Public Function AppendTest(ByVal s As String, ByVal suffix As String)
        Return s & suffix
    End Function
Answers:
• Dim s As String = "test" s = s.AppendTest(s, "suffix")
• Dim s As String = "test" s = s.AppendTest("suffix")
• Dim s As String = "test" s = AppendTest(s, "suffix")
• Dim s As String = "test" s = AppendTest("suffix")
3. Which of the following types guarantee atomic reads and writes?
Answers:
• int
• double
• string
• long
• float
4. Which of the following are true regarding validation in an ASP.NET application?
Answers:
• Server validation should only be used when there is no client side validation.
• All data should be validated on the server side.
• Client Side validation typically provides a faster response (feedback) time than server validation
• A page can not be posted back unless all client validation has passed.
5. Which of the following are true of using ADO.NET DataSets and DataTables?
Answers:
• The connection to the database must remain valid for the life of the data objects
• All tables in a dataset must come from the same database.
• A given instance of a DataTable can be in only one DataSet
• Changes made to multiple tables within a DataSet can easily be transferred to a new DataSet which contains only the changes
• Content from multiple DataSets can easily be combined into a single DataSet that contains the net result of all changes.
6. What is the result of the following code?

Console.WriteLine(CBool(If(1>2, "True", "False")))
Answers:
• Throws an InvalidCastException
• TRUE
• FALSE
• None of the above
7. Given the following code, which calls are valid ways to add the elements of a string array to a List(Of String)?

        Dim values() As String = {"1", "2", "3", "4"}
        Dim valueList As New List(Of String)
Answers:
• valueList.Insert(values)
• valueList = values
• valueList.Add(values)
• valueList.AddRange(values)
8. Determining the availability of sufficient memory for an operation can be accomplished by:
Answers:
• There is no supported application level means to determine if a specific amount of memory is available.
• using static methods of System.Runtime.MemoryFailPoint and checking the return value
• creating an instance of System.Runtime.MemoryFailPoint and monitoring for an InsufficientMemoryException
• creating an instance of System.Runtime.MemoryFailPoint and monitoring for an OutOfMemoryException
9. With which of the following are Declarative Databinding expressions delimited?
Answers:
• <%# %>
• <%-- --%>
• <!-- -->
• <# >
10. Which of the following are valid mechanisms for adding an event handler for Public Event SomeEvent() on class Sample?
Answers:
• AddHandler Sample.SomeEvent AddressOf MyEventHandler Public Sub MyEventHandler
• AddHandler Sample.SomeEvent, AddressOf Sample.SomeEvent
• Private WithEvents sample As New Sample Public Sub MyEventHandler(sender As Object, e As EventArgs) Handles sample.SomeEvent
• Private WithEvents sample As New Sample Public Sub MyEventHandler() Handles sample.SomeEvent
11. What does the AndAlso operator do?
Answers:
• It performs a Boolean AND operation, evaluating both operands
• It performs a Boolean AND operation, evaluating the left-hand side only if the right-hand side is false
• It performs a Boolean AND operation, evaluating the right-hand side only if the left-hand side is false
• It performs a Boolean AND operation, evaluating the right-hand side only if the left-hand side is true
• None of the above
12. With which class is the task of mapping a specific point in time into units such as weeks, months, and years accomplished?
Answers:
• System.DateTime
• System.TimeSpan
• System.Globalization.Calender
• System.Globalization.CultureInfo
13. 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
14. Which of the following can you do when deleting a DataRow from the DataRowCollection of a DataTable?
Answers:
• Use the DataRowCollection.Remove method to immediately delete the row.
• Use the DataRowCollection.Remove method to mark the row for deletion when DataRow.AcceptChanges is called.
• Use the DataRow.Delete method to immediately delete the row.
• Use the DataRow.Delete method to mark the row for deletion when DataRowAcceptChanges is called.
15. Which of the following events should be used for assigning a Theme dynamically to a page?
Answers:
• PreInit
• Init
• PreLoad
• PreRender
• Render
16. Which of the following is applicable when 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
• Once issued, a certificate is always valid until the expiration date.
17. Which of the following is  true about VB generics?
Answers:
• VB allows non-type template parameters
• VB supports explicit specialization
• VB allows the type parameter to be used as the base class for the generic type
• VB allows a generic type parameter itself to be a generic
• VB enforces that all codes are valid for all types of parameters
18. In which of the following ways do Structures differ from classes?
Answers:
• Structures cannot implement interfaces
• Structures cannot inherit from a base structure
• Structures cannot have events
• Structures cannot have overrideable methods
19. The earliest event in which all viewstate information has been restored is:
Answers:
• Init
• PreLoad
• Load
• PreRender
• Render
20. Which method calls will compile the following?

Private Sub Sample(ByVal number As Integer, Optional ByVal bool As Boolean = True)
End Sub
Answers:
• Sample(1, True)
• Sample(1)
• Sample(bool:=False)
• Sample(bool:=False, number:=1)
• Sample(bool:=False, 1)
21. 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
22. In order to enable AJAX Functionality, which control is placed on the page?
Answers:
• asp:ScriptManager
• asp:AjaxManager
• asp:PageManager
• asp:ClientScriptManager
23. 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 client's computer
• A server side in-process memory cache
• Instance member variables of the Page class
24. 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.
• All of the above.
25. In the following example,by which technique can the method Test in the derived class Cat access the implementation of MakeNoise in the base class?

Public Class Animal
    Public Overridable Sub MakeNoise()
    End Sub
End Class

Public Class Cat
Answers:
• Once overridden, the base class members are inaccessible rom the derived class.
• Public Sub Test() Animal.MakeNoise() End Sub
• Public Sub Test() MyBase.MakeNoise() End Sub
• Public Sub Test() CType(Me, Animal).MakeNoise() End Sub
26. Which of the following will be executed without error?

Public Class Fruit
End Class

Public Class Apple
    Inherits Fruit
End Class
Answers:
• Dim list As New List(Of Fruit) list.Add(New Apple) list.Add(New Fruit) Dim apple As Apple = list(0)
• Dim list As New List(Of Fruit) list.Add(New Apple) list.Add(New Fruit) Dim fruit As Fruit = list(0)
• Dim list As New List(Of Apple) list.Add(New Apple) list.Add(New Fruit) Dim apple As Apple = list(0)
• Dim list As New List(Of Apple) list.Add(New Apple) list.Add(New Fruit) Dim fruit As Fruit = list(0)
27. Which of the following are true when using a POST command to access a WebService method?
Answers:
• There is a size limitation on the parameters that can be passed
• A query string is used to pass the parameters.
• By default, JSON formatting is used for serialization
• By default, XML formatting is used for serialization
• The data is automatically deserialized into .NET types before the actual Web Service method is invoked.
28. The earliest event where one can be assured all child controls exist is:
Answers:
• Load
• LoadComplete
• PreRender
• Init
29. Identify the syntactically correct LINQ query or queries, assuming dt is a DataTable
Answers:
• Dim result = (From r In dt Select r.Field(Of Int32)("Value")).Max
• Dim result = Select r.Field(Of Int32)("Value")).Max From dt
• Dim result = Select Max("Value") From dt.AsEnumerable
• Dim result = Aggregate r In dt Into Max(r.Field(Of Integer)("value"))
30. By which contract are the WS-Addressing action and reply action elements of the soap envelope controllable when the Windows Communication Foundation is used?
Answers:
• ServiceContract
• OperationContract
• DataContract
• MessageContract
31. 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.
32. In which file are Predefined Client Side Validation Scripts defined?
Answers:
• WebUIValidation.js
• ClientValidation.js
• AspNetValidation.js
• USerValidation.js
33. Identify the syntactically correct LINQ query or queries, assuming dt is a DataTable
Answers:
• Dim key As String = "test" Dim result = From r In Dt Where r(0) = key Select r(1)
• Dim key As String = "test" Dim result = From r In dt.AsEnumerable Where r(0) = key Select r(1)
• Dim key As String = "test" Dim result = Select r(1) From r In Dt Where r(0) = key
• Dim key As String = "test" Dim result = Select r(1) From r In Dt.AsEnumerable Where r(0) = key
34. What is the result of Console.WriteLine("{0}:{1}:{2}", CInt(2.5), CInt(1.5), Fix(1.5))?
Answers:
• 2:2:2
• 3:2:2
• 3:2:1
• 2:2:1

35. Which of the following are true about Nullable types?
Answers:
• A Nullable type is a reference type.
• A Nullable type is a structure.
• An implicit conversion exists from any non-nullable value type to a nullable form of that type.
• An implicit conversion exists from any nullable value type to a non-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.
36. 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
37. Where should information about a control created at design time be stored?
Answers:
• ApplicationState
• SessionState
• ViewState
• None of the above
38. When aggregating data, LINQ is:
Answers:
• much faster than DataTable.Compute
• much slower than DataTable.Compute
• almost as fast as DataTable.Compute
39. 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.Com file.
• Setting the debug element of the AspNet element to true in the machine.config file true.
• Enabling ASP.NET debugging in the IIS metabase.
40. 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.
41. 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 CurrentCulture property of the current Thread object.
• Examining the Language property of the current Page object.
42. Which of the following statements do Expression Trees fit best?
Answers:
• Expression trees are a data structure which can be initially composed using language syntax
• Expression trees are a dynamically generated code which is executed to perform the desired function
• Expression trees can be created only from Lambda Expressions
• Expression trees can be modified once they are created
• All of the above
43. 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 interference, that anonymous methods do not
• All of the above
44. Which of the following is true regarding the System.DateTimeOffset structure?
Answers:
• It provides an exact point in time relative to the UTC time zone
• It combines a DateTime structure with a TimeZone structure
• It provides arithmetical operations using values with different offsets from the UTC
• It can be used to determine the specific TimeZone for a local time
45. 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
46. Which of the following can be used to preserve state information?
Answers:
• ApplicationState
• SessionState
• ViewState
• Page Instance Variables
• All of the above
47. Which of the following elements can be adjusted when using the ProcessModel element of the Machine.Config file?
Answers:
• The number of queued requests before returning "Server Busy (error: 503)"
• The maximum number of threads per processor
• The maximum number of threads per request
• The maximum amount of memory utilized per request
48. Which of the following are true about declarative attributes?
Answers:
• They must be inherited from the System.Attribute.
• Attributes are instantiated at the same time as instances of the class to which they are applied.
• 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.
49. Which of the following is not an unboxing conversion?
Answers:
• Public Sub Sample1(ByVal o As Object) Dim i As Integer = CInt(o) End Sub
• Public Sub Sample1(ByVal vt As ValueType) Dim i As Integer = CInt(vt) End Sub
• Enum E Hello World End Enum Public Sub Sample1(ByVal et As System.Enum) Dim e As E = CType(et, E) End Sub
• Public Interface I Property Value() As Integer End Interface Public Sub Sample1(ByVal vt As I) Dim i As Integer = vt.Value End Sub
• Public Class C Private _value As Integer Public Property Value() As Integer Get Return _value End Get Set(ByVal value As Integer) _value = value End Set
50. Which of the following are true about System.GC under version 3.5 of the 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
• You should specify LowLatency when using Concurrent Server Garbage Collection to improve memory utilization
51. 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 updated when the interval expires.
• None of the above
52. 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 propery of the Page Object.
• Setting the Cache element in the Web.Config file.
• All of the above
53. Which of the following characteristics does a LINQ query expression should have?
Answers:
• It must begin with a from clause
• It must begin with a select clause
• It can end with a group clause
• It must contain at lease one where clause
• An orderby clause may optionally follow a select clause
54. When using an implicitly typed array, which of the following is most appropriate?
Answers:
• All elements in the initializer list must be of the same type.
• 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
• All elements in the initializer list must be implicitly convertible to a common type which is a base type of the items actually in the list
• There are no restrictions on the items in the initializer list as the array is not declared to be a specific type.
55. 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 CssClass 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
56. Which of the following are true of ADO.NET?
Answers:
• It uses a connected provider model
• It uses Uses a disconnected provider model
• It includes a DataAdapter class, which provides a high-performance mechanism for retrieving data
• System.Data.Common provides classes that are database agnostic
57. Which directive allows the utilization of  a custom web control in an ASP.NET page?
Answers:
• @Register
• @Include
• @Control
• @Import
58. 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
59. Which of the following are true about anonymous types?
Answers:
• They can be derived from any reference type.
• Two anonymous types with the same named parameters in the same order declared in different classes have the same type.
• Anonymous types can have methods
• All properties of an anonymous type are read/write
• Anonymous types cannot cross method boundaries.
60. When Windows Communication Foundation is used, the SessionMode property to disallow, require, or permit is applied to which contract?
Answers:
• ServiceContract
• OperationContract
• DataContract
• MessageContract
61. 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 DataTime.Now for a cookie in the Web.UI.Page.Response.Cookies
• Remove the cookie from the System.Web.UI.Page.Response.Cookies collection.
62. Which of the following is/are true regarding the use of Authentication to control access to the HTML file (.htm .html)?
Answers:
• ASP.NET authentication can not be used to control access
• ASP.NET authentication handles these by default in a manner equivalent to .aspx pages
• The extension can be associated with aspnet_isapi.dll in IIS for the appropriate directory
• A custom HTTP Request processor must be installed to examine the URL's and determine the appropriate access rights.
63. What is the value of b3 after the following code is executed?

        Dim b1 As Boolean? = True
        Dim B2 As Boolean? = Nothing
        Dim b3 As Boolean? = If(b1 AndAlso b2, b1, b2)
Answers:
• System.DbNull.Value
• TRUE
• FALSE
• Nothing
• None of the above(An InvalidCastException is thrown)
64. What does the OrElse operator do?
Answers:
• It performs a Boolean OR operation, evaluating both operands
• It performs a Boolean OR operation, evaluating the left-hand side only if the right-hand side is false
• It performs a Boolean OR operation, evaluating the right-hand side only if the left-hand side is false
• It performs a Boolean OR operation, evaluating the right-hand side only if the left-hand side is true
• None of the above
65. Which of the following are true about Extension methods.
Answers:
• They must be declared static
• 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
66. 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.
• An absolute number of bytes process memory utilization .
• A percentage of physical memory utilized by the process.
• A specific time interval
• A specific date and time
67. Which of the following are true about System.Security.Cryptography under version 3.5 of the framework?
Answers:
• None of the implementations are FIPS-certified
• 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
68. Which features that are not supported in the System.TimeZone class does the System.TimeZoneInfo class provide?
Answers:
• It provides readable names for both regular time and (if appropriate) daylight savings time
• It provides a means of enumerating the known time zones that are available on the local system
• It provides functionality to create custom time zones
• It provides the period for which the time zone was in effect. For example : From 1986 to 2006, it was from the first Sunday in April to the last Sunday in October, but starting 2007, it is observed from the second Sunday in March to the first Sunday in November.
69. What is the value of r after the following code is executed?
        Dim f As Func(Of Integer, Boolean) = Function(x) (x + 2) > 7
        Dim r = f(7)
Answers:
• 9
• TRUE
• The code will not compile due to an InvalidCastException
• May be 1 or -1, depending on the system setting for casting Boolean values to integers
70. Which of the following are true of the System.Text.StringBuilder class?
Answers:
• It is less efficient than string concatenation when many concatenations are performed.
• There is a method which formats the string being appended to the StringBuilder, much like the String.Format.
• The StringBuilder is most efficient when initialized using the parameterless constructor.
• All of the above
• None of the above
71. Which of the following are true regarding System.Threading.ReaderWriterLockSlim?
Answers:
• It is optimized for single processor/core operations
• It is optimized for usage where writes from multiple sources are common
• A thread which has a read lock on a resource may not acquire a write lock on the same resource
• 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
72. 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 the class defined in the CodeFile.
• 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.
73. Which of the following are the goals of the Windows Communication 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
74. 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.
• TreeView, Menu, Substitution, and Validation controls can not be used within an UpdatePanel.
75. Where should an instance of an object which provides services to all users be stored?
Answers:
• ApplicationState
• SessionState
• ViewState
• None of the above
76. Which of the following statements are true about Passport Authentication?
Answers:
• The Passport SDK must be installed.
• Passport authentication is a free service for all sites provided by the Microsoft Corporation.
• Passport authentication requires a network path between the Client and the Microsoft Passport Server
• Passport Authentication provides persistent authentication across sessions