oDesk Test answers for DotNet 2.0 using VB Test 2015

70 NOT Answered Yet Test Questions:

(hold on, will be updated soon)
1. 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
2. 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 to itself be a generic
VB enforces that all code is valid for all type parameters
3. Which of the following are true about namespaces and assemblies?
Answers:
Namespaces may be used to control access to contained classes
Assemblies may be used to control access to contained classes
Namespaces may be aliased to provide a shorthand notation for a fully qualified identifier
The same namespace may be used in multiple assemblies
A single assembly may contain multiple namespaces
4. 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.
5. 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 only to be applied to application element types.
By default, a given attribute may be applied multiple times to the same application element.
6. 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.
7. Which of the following is not a standard service behavior supported by the System.ServiceProcess.ServiceController class members?
Answers:
Start
Continue
Pause
Restart
8. Which of the following are valid mechanisms for adding an event handler for Public Event SomeEvent() on the class Sample?
Answers:
AddHandler Sample.SomeEvent AddressOf MyEventHandler Public Sub MyEventHandler
AddHandler Sample.SomeEvent, AddressOf Sample.SomeEvent<br>
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
9. Which of the following code samples will cause a compilation error?
Answers:
Public Class Sample End Class Public Class Sample(Of T) End Class
Public Class Sample(Of T) End Class Public Class Sample(Of T, U) End Class
Public Class Sample(Of T As Class) End Class Public Class Sample(Of T As Structure) End Class
Public Class Sample End Class Public Class Sample(Of T As Class) End Class
10. 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 extracted 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.
11. Which of the following types are derived from System.Reflection.MemberInfo?
Answers:
System.Reflection.PropertyInfo
System.Reflection.EventInfo
System.Type
System.Reflection.InstanceInfo
12. Elements in a System.Collections.Specialized.OrderedDictionary are:
Answers:
sorted by Key
sorted by Element
not sorted
13. 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
14. Which System.Remoting class is used to transfer information across an AppDomain boundary?
Answers:
ObjRef
MarshalByRefObject
ObjectHandle
RemotingServices
15. Which of the following  is a primary characteristic of System.Xml.XmlDataDocument?
Answers:
It provides synchronized operations viewing the content either as an XmlDocument or as a DataSet
It provides the basic abilities for XMLDocument instances to be created from or exported to DataSets
It provides a limited set of capabilities compared to the System.Xml.XmlDocument class
It provides the basic abilities to allow DataSets to be loaded from or exported to XML files.
16. 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 the type System.Collections.DictionaryElement
All of the above
17. Which of the following are true of parameters?
Answers:
Changes to value parameters always involve making a copy of the original argument
Items passed as reference parameters must be initialized prior to the call
Output parameters do not need to be assigned inside the method
Variable length argument lists are not supported
18. 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
19. Which of the following are valid as the underlying type for an enumeration?
Answers:
integer
sbyte
char
long
20. 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)
21. 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:2
2:2:1
22. Custom non-fatal exceptions should be derived from:
Answers:
ApplicationException
DataMisalignedException
ExecutionEngineException
SystemException
23. The framework provides three different timer classes. Select the answer that properly matches the class with the listed characteristic.
Answers:
System.Threading.Timer A 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 the System.Windows.Forms.Timer instances.
System.Windows.Forms.Timer A lower resolution timer which requires a UI message pump on the creating thread.
All of the above
24. Which access limitation does a class member declared Protected Friend have?
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
25. Of which elements does Generics allow parameterization by type?
Answers:
Classes
Structs
Methods
Events
Fields
26. Which of the following are true when comparing built in types for equality?
Answers:
Integral types are considered equal if they represent the same value.
Object types are considered equal if they both refer to the same object or if both are null
String types are considered equal if they have identical lengths and identical characters in each character position
String types are considered equal if they have identical dimensions and identical content at each array index
27. 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.
28. 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
29. Which of the following characteristics is found 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 whether it is UTC, Local, or Unspecified
30. 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
31. Which of the following does NOT apply to XCOPY deployment?
Answers:
The appropriate version of the .NET framework must be installed.
All application components must be in the application directory, or a subdirectory.
Shared components can be installed as part of the XCOPY.
XCOPY deployment to a non-empty target directory may have unintended side-effects
32. Which of the following operators can be overloaded?
Answers:
Assignment (=)
Conditional (AndAlso,OrElse)
Logical (And, Or, Xor)
Shift (<<, >>)
33. 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
34. Which of the following are true about statements?
Answers:
A while statement will always execute its body at least once.
A for loop will always execute its body at least once.
A try statement must always include at least one catch block
A case clause within a switch statement may not fall through to the next case clause
35. What will be the output generated by the following code?
        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
36. Which of the following encodings are NOT supported by classes in the System.Text namespace?
Answers:
ASCII
Unicode
UTF-7
UTF-8
EBCDIC
37. Which of the following is not a valid attribute for impacting serialization?
Answers:
DataContract
DataMember
EnumMember
CollectionDataContract
DataObject
38. 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
39. Which of the following characteristics is found in overloaded methods?
Answers:
They must have the same name
They must have the same parameter signature
They must have the same return type
They must have the same access level
None of the above
40. Which of the following conditions are true regarding System.Diagnostics.Trace
Answers:
Trace is enabled for both Release and Debug initial configurations
Trace can be controlled both by preprocessor directives, and compiler directives
To change the severity levels which generate output, you must recompile your program
You can create enhanced capabilities by inheriting from the System.Diagnostics.Trace class
41. Which of the following are true about event handling?
Answers:
One method may handle events from different sources
A single event can be handled by multiple methods
Event handlers must be members of the same class as raised the event
Event handlers can be dynamically added and removed at runtime
It is impossible to determine the order in which event handlers will be invoked
42. 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
43. 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
44. 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.
45. Which of the following can Interfaces contain?
Answers:
Methods
Properties
Fields
Conversion operators
Events
46. 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
47. What output will be generated by the following code?
Dim sb As New StringBuilder(10)
        sb.AppendFormat("1234567890123")
        Console.WriteLine(sb.Capacity)
Answers:
10
13
Some value equal to or larger than 13
Int32.MaxValue
48. 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.
49. Which of the following is NOT a requirement for an application to be certified in the "Certified for Windows Program"
Answers:
Usage of system settings for size, color, and font
Support for Windows "High Contrast" option
Usage of sound to notify of critical information
Keyboard only access to all features including menus, and controls
50. Which of the following is not a valid value for DataRowState?
Answers:
Added
Deleted
Dirty
Detached
51. Which of the following is NOT part of an assembly?
Answers:
Manifest
MetaData
Intermediate Language Code
Resources
Native Executable Code
52. Given the following code, which calls will be 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)
53. 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)
54. Which of the following operations can NOT be performed inside a catch block?
Answers:
Prevention of the caught exception from leaving the catch block
Allowing the original exception to propagate after it has been caught, with all of the information (including context) intact
Wrapping the caught exception inside a newly created exception of a different type
Generating a new exception with no information about the original exception
Altering the Message , TargetSite and/or StackTrace, of the existing exception before re-throwing
55. 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
56. An executable code that will be dynamically created within a running application__________.
Answers:
is not possible with VB
should be done using the Microsoft.VisualBasic.Compiler class
should be done using the Microsoft.VisualBasic.VBCodeProvider class
should be done by explicitly creating a process and running vbc.exe
requires that Visual Studio is installed and automated to create the new code
57. 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
58. Transactions initiated in which of the following are supported by System.Transactions infrastructure?
Answers:
SQL Server
ADO.NET
MSMQ
Microsoft Distributed Transaction Coordinator (MSDTC).
All of the above
59. 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
60. The term Encapsulation is most commonly used to mean:
Answers:
separating an item's public interface from the actual implementation
embedding content as a resource into an executable program
providing a short summary description of complex operations
a technique using base and derived classes
61. Public Class Sample
    Public Sub New(ByVal x As Integer)
    End Sub
End Class
In the above code, which of the following other class constructors can directly access the provided constructor?
Answers:
Public Sub New() Me.New(1) End Sub
Public Sub New() New(1) End Sub
Both the the above.
One class constructor cannot directly access another constructor
62. Which of the following can  one perform to create a System.Type instance for a given specialization of a generic?
Answers:
Call the Type.MakeGenericType(...)method on an instance of System.Type which represents the Generic, specifying the types of the generic parameters.
Call the static Type.MakeGenericType(...) method specifying both the base type and the types of the generic parameters.
Call the GetType() method on an instance of the specialization
Call Reflection.Emit(...)
Call the Type.GetGenericTypeDefinition() method
63. Which of the following types guarantee atomic reads and writes?
Answers:
int
double
string
long
float
64. Which of the following is true about exceptions?
Answers:
Exceptions should be derived from the System.Exception, but are not required to do so.
If no catch block is found for an exception, and the source is not a static constructor, a System.ThreadException will be thrown
Mathematical errors such as divide by zero, or numeric overflow will generate an exception that is derived from System.Exception
Every throw statement must have at least one catch block
65. 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? = IIf(b1 AndAlso b2, b1, b2)
Answers:
System.DbNull.Value
TRUE
FALSE
Nothing
None of the above (An InvalidCastException is thrown)
66. Which of the following are true about using the System.Messaging.MessageQueue class?
Answers:
It provides communication across heterogeneous networks
It provides communication when one of the endpoints may be off-line
It may behave differently depending on the current operating system
A new system level queue may be created simply by creating an instance of MessageQueue.
67. 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")
68. 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
69. Parameterized Properties in VB are__________.
Answers:
not supported except for implementing and indexer.
properties which take one or more parameters (e.g. to retrieve one element from a member collection)
properies which use one or more attributes to control their behavior
properties which can be passed as Method Parameters so they can be invoked by the called method.
70. Which of the following can an interface NOT contain?
Answers:
Methods
Events
Fields

Indexers
SHARE

Blogger

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

0 comments:

Post a Comment