36 Answered Test Questions:
1. Which of the following applies to interface inheritance?
Answers:
• If
a class implements an interface, the implementation can be provided
by a public member of a base class.
•
A
class may partially implement an interface by only declaring some of
the members
•
Interface
methods may be implemented so that they are NOT directly accessible
using an instance reference to the class
• Since
interface implementation methods can not be declared
private,protected, or internal, they are always accessible from any
point in an application
2. 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.
3. Which of the following are true about Nullable types?
Answers:
•
A
Nullable type is a structure.
•
An
implicit conversion exists from any nullable value type to a
non-nullable form of that type.
4. Which of the following are true about declarative attributes?
Answers:
•
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.
5. What output will be generated by the following code? StringBuilder sb = new StringBuilder(10); sb.AppendFormat("1234567890123"); Console.WriteLine(sb.Capacity);
Answers:
•
10
•
Some
value equal to or larger than 13
•
Int32.MaxValue
6. The term Encapsulation is most commonly used to mean:
Answers:
•
embedding
content as a resource into an executable program
•
providing
a short summary description of complex operations
•
a
technique using base and derived classes
7. Which of the following are true about namespaces and assemblies?
Answers:
•
A
single assembly may contain multiple namespaces
•
The
same namespace may be used in multiple assemblies
•
Namespaces
may be aliased to provide a shorthand notation for a fully qualified
identifier
8. 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.
9. Transactions initiated in which of the following are supported by System.Transactions infrastructure?
Answers:
•
SQL
Server
•
ADO.NET
•
MSMQ
•
Microsoft
Distributed Transaction Coordinator (MSDTC).
10. 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.
11. When developing a managed client to be used with an existing COM Component, __________.
Answers:
•
you
should use TlbImp.exe to create a managed wrapper
•
you
should use TlbExp.exe to create a managed wrapper
•
you
should enable an unsafe code
12. Which of the following are true about anonymous methods?
Answers:
•
An
anonymous method requires an explicit method signature
•
An
anonymous method can impact the lifetime of local variables and
parameters of the containing function
•
A
struct may not declare an anonymous method which directly references
member fields
13. Elements in a System.Collections.Specialized.OrderedDictionary are:
Answers:
•
sorted
by Key
•
sorted
by Element
14. class Sample { public Sample(int x) { } } In the above code, which of the following other class constructors can directly access the provided constructor?
Answers:
•
public
Sample() : Sample(1) {}
•
Both
the above.
•
One
class constructor can not directly access another constructor
15. Which of the following code samples will cause a compilation error?
Answers:
•
class
SampleClass {} class SampleClass<T> {}
•
class
SampleClass<T> {} class SampleClass<T,U> {}
•
class
SampleClass {} class SampleClass<T> where T : class { }
16. Which of the following are true about statements?
Answers:
•
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
17. If two assemblies contain the same fully qualified class, which of the following will be true?
Answers:
•
A
new root can be added to the assemblies namespace hierarchy by the
use of an extern alias
•
The
specific colliding name may be altered by using an extern alias
•
The
collision may be avoided by using a statement to provide an alias
18. Which of the following are true about delegates?
Answers:
•
A
delegate requires an instance method be supplied.
•
Delegates
are not typesafe
•
A
delegate instance does not know or care about the class type of the
encapsulated method
19. When Deleting a DataRow from the DataRowCollection of a DataTable, you can:
Answers:
•
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.
20. Which access limitation does a class member declared protected internal 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
21. In which of the following ways do structs differ from classes?
Answers:
•
Structs
can not implement interfaces
•
Structs
cannot have events interfaces
•
Structs
cannot have virtual methods
22. Which of the following are true about enums?
Answers:
•
A
variable of the enum type will always contain one of the declared
symbolic constants
•
The
declared values of an enum are always assigned sequential starting
with 0
•
The
declared values of an enum must be mapped (explicitly or implicitly)
to unique integral values
23. 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.
24. Custom non-fatal exceptions should be derived from:
Answers:
•
DataMisalignedException
•
ExecutionEngineException
•
SystemException
25. Which of the following are defined as a "token"?
Answers:
•
Whitespace
•
Punctuator
•
Operator
•
All
of the above
26. Of which elements does Generics allow parameterization by type?
Answers:
•
Structs
•
Methods
•
Fields
27. 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
28. 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.
29. Which of the following are true about event handling?
Answers:
•
One
method may handle events from different sources
•
Event
handlers can be dynamically added and removed at runtime
•
All
of the above
30. Which of the following conditions are true regarding System.Diagnostics.Trace?
Answers:
•
Trace
can be controlled both by preprocessor directives, and compiler
directives
•
To
change the severity levels which generate output, you must recompile
your program
•
All
of the Above
31. Parameterized Properties in C# are__________.
Answers:
•
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.
32. 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
33. What will be the output generated by the following code? string t = "This Is a Test"; t.Replace("T", "?"); Console.WriteLine(t);
Answers:
•
?his
Is a ?est
•
?his
Is a ?es?
•
?his
Is a Test
34. Which of the following are true about operator precedence?
Answers:
•
All
binary operators are left-associative, and evaluate from left to
right.
•
The
Assignment and Conditional Operators are right-associative.
•
The
Conditional And (&&) and Or (||) operators have higher
precedence than the Logical And (&) and Or (|) operators.
35. Which of the following can Interfaces contain?
Answers:
•
Methods
•
Properties
•
Fields
•
Events
36. 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
33 NOT Answered Yet Test Questions:
(hold
on, will be updated soon)
37. Which of the following are true about pointers?
Answers:
•
C#
does not support the use of "*" to indicate a pointer.
•
Pointers
are a type derived from System.Object
•
Pointers
can be used as out and ref type parameters
•
Pointer
references are tracked by the garbage collector.
38. Which of the following operators can be overloaded?
Answers:
•
Assignment
(=)
•
Conditional
(&&,||)
•
Logical
(&,|,^)
•
Shift
(<<, >>)
39. Which of the following is not a valid value for DataRowState?
Answers:
•
Added
•
Modified
•
Dirty
•
Detached
•
Deleted
40. 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.Calendar
•
System.Globalization.CultureInfo
41. Which of the following is NOT a valid C# preprocessor directive?
Answers:
•
#define
•
#line
•
#include
•
#error
•
#pragma
42. Which of the following are valid as the underlying type for an enumeration?
Answers:
•
int
•
sbyte
•
long
•
All
of the above
43. Which of the following can an interface NOT contain?
Answers:
•
Methods
•
Events
•
Fields
•
Indexers
44. 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
45. 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.
46. Which of the following characteristics are found in an iterator?
Answers:
•
It
is a statement block which may contain a yield return statement to
provide the next value of the iteration
•
It
is a statement block which may contain a yield break statement to
provide the next value of the iteration
•
It
is a statement block which may contain a yield return statement to
indicate that the iteration is complete
•
It
is a statement block which may contain a yield break statement to
indicate that the iteration is complete
•
It
is a class which implements Ienumerable
47. Which of the following are true for 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
48. 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
49. Which of the following is false regarding arrays?
Answers:
•
For
reference types A and B; if a conversion from A to B exists, a
conversion from A[] to B[] also exists
•
For
value types A and B; if a conversion from A to B exists, a conversion
from A[] to B[] also exists
•
Assignments
to arrays elements may require a runtime check to validate the type
safety of the assignment
50. Which of the following is an effect of marking resources in satellite assemblies?
Answers:
•
It
renders the resources unavailable.
•
It
ensures that resources are used only with the appropriate culture
•
It
prevents identifier collisions between multiple satellite assemblies
•
It
has no impact since access specifiers for resources are not applied.
51. 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
52. 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#
allows a generic type parameter itself to be a generic
•
C#
enforces that all codes are valid for all types of parameters
53. Which System.Runtime.Remoting class is used to store all relevant information required to generate a proxy in order to communicate with a remote object?
Answers:
•
ObjRef
•
MarshalByRefObject
•
ObjectHandle
•
RemotingServices
54. 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
55. Which of the following is not a valid attribute for impacting serialization?
Answers:
•
DataContractAttribute
•
DataMemberAttribute
•
EnumMemberAttribute
•
CollectionDataContractAttribute
•
DataObjectAttribute
56. 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
57. Which of the following types guarantee atomic reads and writes?
Answers:
•
int
•
double
•
string
•
long
•
float
58. Which of the following characteristics are found in overloaded methods?
Answers:
•
They
must have the same name
•
They
must have the same parameter signature
•
They
must have the same access level
•
None
of the above
59. Which of the following are typical steps in creating a managed COM server component?
Answers:
•
Assigning
a GUID to each exposed interface and implementation via the
System.Runtime.InteropServices.GuidAttribute
•
Enabling
an unsafe code
•
Registering
the server assembly with the system using RegAsm.exe
•
Registering
the server assembly�with the system using RegSvc32.exe
60. 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
61. 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
62. Which of the following is not a standard service behavior supported by the System.ServiceProcess.ServiceController class members?
Answers:
•
Start
•
Continue
•
Pause
•
Restart
63. Which of the following properties are found in Static Constructors?
Answers:
•
Static
constructors are called before the main program is executed
•
Static
constructors are called before the first instance of a class is
created
•
Static
constructors are called before any static (non-constructor) members
are called
•
Static
constructors can take parameters
64. Which of the following types are derived from System.Reflection.MemberInfo?
Answers:
•
System.Reflection.PropertyInfo
•
System.Reflection.EventInfo
•
System.Type
•
System.Reflection.InstanceInfo
65. Which System.Runtime.Remoting class is used store all relevant information required to generate a proxy in order to communicate with a remote object?
Answers:
•
ObjRef
•
MarshalByRefObject
•
ObjectHandle
•
RemotingServices
66. Which of the listed characteristics is found in the following code sample? [DllImport("msvcrt.dll")] public static extern int puts([MarshalAs(UnmanagedType.LPStr)] string m);
Answers:
•
It
physically includes the native code for puts in the current assembly
•
It
generates a wrapper class for the puts method
•
It
provides sufficient information so the Platform Invoke functionality
can be used to call the function in the msvcrt.dll
•
It
enables an unsafe code
67. Which of the following is not an application entry point?
Answers:
•
public
static void Main() {}
•
public
static int Main() {}
•
public
static int Main(string[] args) {}
•
public
static int Main(string cmdline) {}
•
private
static int Main(string[] args) {}
68. 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
69. Which of the following encodings are NOT supported by classes in the System.Text namespace?
Answers:
•
ASCII
•
Unicode
•
UTF-7
•
UTF-8
• EBCDIC
0 comments:
Post a Comment