Odesk Test answers for DotNet 3.5 using VB Test 2015

66 NOT Answered Yet Test Questions:

(hold on, will be updated soon)
1. 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
2. Which of the following scenarios are applicable to Window Workflow Foundation?
Answers:
Document-centric workflows
Human workflows
User-interface page flows
Builtin support for communications across multiple applications and/or platforms
All of the above
3. Given the following code, which calls are valid ways to add the elements of a string array to a List(Of Strings)?

    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)
4. Which of the following operators can be overloaded?
Answers:
Assignment (=)
Conditional (AndAlso,OrElse)
Logical (And, Or, Xor)
Shift (<<, >>)
5. In which of the following types of applications can Windows Workflow Foundation be used?
Answers:
Console Applications
Windows Forms based Applications
Windows Presentation Foundation based Applications
ASP.NET based applications
All of the above
6. 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
7. Which of the following are true about BackgroundWorker?
Answers:
It is a member of the System.Threading namespace.
It abstracts away the details of cross-thread marshalling of data.
The BackgroundWorker thread aborts immediately when the CancelAsync method is called.
It provides mechanisms for reporting progress, reporting completion and cancelling.
8. 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
9. 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.
10. 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
11. Which access limitation is there in a class member declared "Protected Friend"?
Answers:
Access is limited to the containing class plus any classes derived from the containing class
Access is limited to the current assembly
Access is limited to the containing class plus any classes derived from the containing class that are also in the current assembly
Access is limited to the containing class plus any classes derived from the containing class or any other class in the current assembly
12. 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")
13. By which contract are the WS-Addressing action and reply action elements of the soap envelope controllable when Windows Communication Foundation is used?
Answers:
ServiceContract
OperationContract
DataContract
MessageContract
14. 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
15. When Deleting a DataRow from the DataRowCollection of a DataTable, you can:
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.
16. Which of the following are valid assignments?
Answers:
Dim i As Int32 = Int16.MaxValue
Dim s As Single = Double.MaxValue
Dim s2 As String = Int64.MaxValue
Dim i2 As Int32 = Int64.MaxValue
17. Which of the following characteristics do classes in the System. Drawing namespace such as Brush, Font, Pen, and Icon share?
Answers:
They encapsulate native resources and must be properly disposed to prevent potential exhausting of resources.
They are all MarshalByRef derived classes, but functionality across AppDomains has specific limitations.
You can inherit from these classes to provide enhanced or customized functionality.
They are Value Type objects.
18. Which of the following are true regarding the System.Collections.Generic.HashSet(Of T) class
Answers:
HashSet is an unordered collection.
HashSet requires that each element be unique as determined by either a supplied EqualityComparer or the default EqualityComparer
Operations on sets (Union, Intersection, etc) always create new result sets
HashSet provides functionality for "conceptual sets" where the rules for membership can be specified without actually creating all of the items.
All of the above
19. Which of the following are valid means of reading all data from a file into a string?
Answers:
Dim sr As New System.IO.StreamReader("C:\temp\myfile.txt") Dim s As String = sr.ReadLine
Dim sr As New System.IO.StreamReader("C:\temp\myfile.txt") Dim s As String = sr.Read
Dim sr As New System.IO.StreamReader("C:\temp\myfile.txt") Dim s As String = sr.ReadAll
Dim s As String = My.Computer.FileSystem.ReadAllText("C:\temp\myfile.txt")
20. 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
21. To which of the following can System.IO.IsolatedStorage not be scoped?
Answers:
Restricted to a Specific Application
Restricted to a Specific AppDomain
Restricted to a Specific User
Restricted to a specific Physical Media
22. Which of the following characteristics is present in the DateTime type?
Answers:
It always references the UTC (GMT) time
It always references the Local time
It contains a member indicating which time zone it refers to
It contains a member indicating the time is UTC, Local, or Unspecified
23. 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 equalityl unless the HashTable constructor is provided with an IEqualityComparer parameter.
Each Element in a HashTable is stored as a Key/Value pair of type System.Collections.DictionaryElement
All of the above
24. 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
25. The default number of threads per processor in the System.Threading.ThreadPool class under version 3.5 of the Framework is?
Answers:
1
25
250
100
500
26. 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
27. 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 UTC
It can be used to determine the specific TimeZone for a local time
28. Which of the following is most appropriate when using an implicitly typed array?
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 the common type which is the 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.
29. Public Class Sample
    Public Sub New(ByVal x As Integer)
    End Sub
 End Class
In the above code, in which of the following can other class constructors directly access the provided constructor?
Answers:
Public Sub New() Me.New(1) End Sub
Public Sub New() New(1) End Sub
Both a and b
One class constructor can not directly access another constructor
30. 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)
31. Which of the following do the advantages of Lambda Expressions over Anonymous methods include?
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
32. Which of the following are valid mechanisms for adding an event handler for Public Event SomeEvent() on a 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
33. 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"))
34. 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
35. 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
36. 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
37. 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
38. The output generated by the following code will be?

Dim t As String = "This Is a Test"
t.Replace("T", "?")
Console.WriteLine(t)
Answers:
?his Is a ?est
?his Is a ?es?
This Is a Test
?his Is a Test
39. Of which elements does Generics allow parameterization by type?
Answers:
Classes
Structs
Methods
Events
Fields
40. 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 reflect their applicability in a better way
41. 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
42. Which of the following types guarantee atomic reads and writes?
Answers:
int
double
string
long
float
43. Which of the following will execute 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)
44. Which of the following does System.IO.Pipes namespace provide?
Answers:
Interprocess communication through anonymous and/or named pipes.
Access to named pipes using System.IO.Stream
Access to the system level pipe security implemented as discretionary access control lists (DACL) and/or system access control lists (SACL),
Asynchronous read and write operations
All of the above
45. 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
46. 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 the Rijndael based encryption.
47. 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 (i.e. how often it performs collections) while your program is running
You can control the intrusiveness of the garbage collector (i.e. how often it performs collections) only during application initialization
You should specify LowLatency when using Concurrent Server Garbage Collection to improve memory utilization
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. To which contract is the SessionMode property to disallow, require, or permit applied when Windows Communication Foundation is used?
Answers:
ServiceContract
OperationContract
DataContract
MessageContract
50. Which of the following characteristics are found in a Query expression?
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 least one where clause
An orderby clause may optionally follow a select clause
51. Custom non-fatal exceptions should be derived from:
Answers:
ApplicationException
DataMisalignedException
ExecutionEngineException
SystemException
52. Which of the following are true about 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.
53. Given the following code, what will be the output when Test() is called?

Delegate Function SampleDelegate(ByVal s As String) As String
<Extension()> _
    Public Function ExtensionTest(ByVal s As String, ByVal del As SampleDelegate)
        Return del(s)
Answers:
value
valuetest
testvalue
valuevalue
54. When using the Demand method of System.Security.IPermission, which of the following will occur?
Answers:
The permissions of the code which invoked the Demand method will be evaluated.
For permissions which do a stack walk, an exception will occur only if NONE of the calling codes has the required permission
For permissions which do a stack walk, an exception will occur if ANY of the calling codes does not have the required permission
The permission levels of individual stack frames are always checked regardless of the permission type.
55. The framework provides three different timer classes. Select the answer that properly matches the class with the listed characteristic.
Answers:
System.Threading.Timer Simple timer which requires a delegate to be supplied for execution when the timer expires. Execution of the method provided by the delegate will be invoked on a ThreadPool Thread.
System.Timers.Timer: Designed for use with worker threads in a multithreaded environment. Can move among threads to handle the raised Elapsed event May result in more accuracy than System.Windows.Forms.Timer instances.
System.Windows.Forms.Timer Lower Resolution timer which requires a UI message pump on the creating thread.
All of the above
56. 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 the time zone was in effect for. For example: From 1986 to 2006, it was observed from the first Sunday in April to the last Sunday in October, but since 2007, it is being observed from the second Sunday in March to the first Sunday in November
57. Within Windows Workflow Foundation, Compensating Actions are used for:
Answers:
providing a means to rollback a failed transaction
providing a means to undo a successfully committed transaction later
providing a means to terminate an in process transaction
achieving load balancing by adapting to current activity
58. Which of the following are true with respect to the standard implementation of Garbage Collection?
Answers:
Objects must be set to null in order to be eligible for garbage collection
Unless specific steps are taken, an object may be moved in memory
Objects become eligible for garbage collection as soon as it is impossible for any code to access it
Objects which implement finalizers will always have the finalizer called at some point
59. Which of the following are true of ADO.NET?
Answers:
It uses a connected provider model
It 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
60. Which of the following are characteristics of the System.Threading.Timer class?
Answers:
The method provided by the TimerCallback delegate will always be invoked on the thread which created the timer.
The thread which creates the timer must have a message processing loop (i.e. be considered a UI thread)
The class contains protection to prevent reentrancy to the method provided by the TimerCallback delegate
You can receive notification of an instance being Disposed by calling an overload of the Dispose method.
61. When aggregating data, LINQ is:
Answers:
much faster than DataTable.Compute
much slower than DataTable.Compute
almost as fast as DataTable.Compute
62. Which of the following are not  valid namespaces in the .NET framework?
Answers:
System.Data.OleDb
System.Data.SqlServer
System.Data.Oracle
System.Data.Xml
System.Data.SqlClient
63. 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
64. 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
65. 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
66. When using version 3.5 of the framework in applications which emit dynamic code, which of the following are true?
Answers:
A partial trust code cannot emit and execute a code
A partial trust application must have the SecurityCritical attribute called Assert ReflectionEmit permission
The generated code no more permissions than the assembly which emitted it.

Can be executed by calling System.Reflection.Emit.DynamicMethod( string name, Type returnType, Type[] parameterTypes ) without any special permissions
SHARE

Blogger

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment