Which one of the following code samples implements an external method call?
Choice 1
[DLLImport("user32")]
extern "C" int MessageBox (int hWnd, string text, string caption, uint type);
Choice 2
[DLLImport("user32")]
public abstract extern int MessageBox (int hWnd, string text, string caption, uint type);
Choice 3
[DLLImport("user32")]
public extern int MessageBox (int hWnd, string text, string caption, uint type);
Choice 4
[DLLImport("user32")]
public shared extern int MessageBox (int hWnd, string text, string caption, uint type);
Choice 5
[DLLImport("user32")]
public static extern int MessageBox (int hWnd, string text, string caption, uint type);
C#, Question 1 of 40
ThreadStart is defined in the namespace System.Threading. What type of entity is ThreadStart?
Choice 1
Delegate
Choice 2
Struct
Choice 3
Class
Choice 4
Pointer
Choice 5
Marshaler
What is the name of the implicit input parameter of a set accessor for any property?
Choice 1
The name of the property
Choice 2
rhs
Choice 3
Value
Choice 4
value
Choice 5
RHS
C#, Question 3 of 40
Of which one of the following is the Common Language Specification (CLS) a subset?
Choice 1
Common Base System
Choice 2
Common Type System
Choice 3
Common Language System
Choice 4
Global Type System
Choice 5
Global Language Specification
C#, Question 5 of 40
When a new instance of a type is created, what is the type of method implicitly called?
Choice 1
New
Choice 2
Creator
Choice 3
Generation
Choice 4
Activator
Choice 5
Constructor
C#, Question 6 of 40
Which one of the following implements a do/while loop?
Choice 1
do {i++;} while (i <= 10);
Choice 2
do() {i++;} while() {i <= 10};
Choice 3
do {i++;} while {i <= 10};
Choice 4
do() {i++;} while (i <= 10);
Choice 5
do (i++;) while (i <= 10);
C#, Question 7 of 40
Scenario
You have developed an application that supports English locales. You have decided to export this application to Japan, and now you want to build in support for Japanese localization. You want to include various culture-related information (including language, date and time formats, and calendar information).
Given the above scenario, what is the system namespace that contains the relevant functions for implementation of this new feature?
Choice 1
System.Formatting
Choice 2
System.Text
Choice 3
System.Localization
Choice 4
System.Resources
Choice 5
System.Globalization
C#, Question 8 of 40
What interface do you implement in order to provide a user of your class deterministic, destructor-like cleanup?
Choice 1
IDisposable
Choice 2
ITerminate
Choice 3
ILease
Choice 4
IAppDomainSetup
Choice 5
IDestructor
C#, Question 9 of 40
Sample Code
public void A() {
int x;
x = 8;
x *= 4 + 8 / 2;
}
Given the above code, what is the value of "x"?
Choice 1
20
Choice 2
36
Choice 3
48
Choice 4
64
Choice 5
96
C#, Question 10 of 40
Sample Code
if (a > b)
c = 'a';
else {
if (b == d)
c = 'e';
else
c = 'b';
}
What implementation of the ternary operator rewrites the above code?
Choice 1
c = (a > b) ? 'a' : (b == d) ? 'e' : 'b';
Choice 2
c = (b == d) ? 'e' : (a > b) ? 'a' : 'b';
Choice 3
c = (b = d) ? 'e' : ((a > b) ? 'a' : 'b');
Choice 4
c = (a > b) ? 'a' : (b = d) ? 'e' : 'b';
Choice 5
c = (a > b) ? 'a' : ((b = d) ? 'e' : 'b');
C#, Question 11 of 40
What C# keyword class access modifier specifies that the class is concrete and CANNOT be derived from?
Choice 1
sealed
Choice 2
abstract
Choice 3
not inheritable
Choice 4
final
Choice 5
internal
C#, Question 12 of 40
How do you implement a read-only property?
Choice 1
Mark the property with the sealed access modifier.
Choice 2
Mark the property with the protected access modifier.
Choice 3
Include the readonly access modifier in the property declaration.
Choice 4
Mark the property with the private access modifier.
Choice 5
Implement only a get accessor.
C#, Question 13 of 40
What statements can enclose a "continue" statement?
Choice 1
switch, while, do, for, or foreach
Choice 2
switch, while, do, for, or for each
Choice 3
while, do, for, or for each
Choice 4
while, do, for, or foreach
Choice 5
try, while, do, for, or for each
C#, Question 14 of 40
Sample Code
static void Main(string[] args) {
int j = 1;
do {
int i = 0;
i++;
} while (i < j);
}
Why does the above code NOT compile?
Choice 1
Variables cannot be defined within the body of a "do" statement.
Choice 2
The variable "i" is defined in the body of the "do" statement's block.
Choice 3
The compiler determines that the code path will lead to only one execution and throws an error.
Choice 4
The "while" statement only has access to variables defined within the body of the "do" statement.
Choice 5
The boolean expression must be implemented directly after the "do" keyword.
What keyword defines a "critical section" of code?
Choice 1
mutex
Choice 2
fixed
Choice 3
synchronize
Choice 4
lock
Choice 5
pin
C#, Question 16 of 40
Which one of the following keywords causes a compile time error if used in a static method?
Choice 1
lock
Choice 2
fixed
Choice 3
continue
Choice 4
using
Choice 5
this
C#, Question 17 of 40
Sample Code
static void Main(string[] args) {
try{
Console.WriteLine("Level 1");
try {
Console.WriteLine("Level 2");
goto exit;
}
finally {
Console.WriteLine("Level 2 Finished");
}
}
finally {
Console.WriteLine("Level 1 Finished");
}
exit: ;
}
What is the console output for the above code sample?
Choice 1
Level 1
Level 2
Choice 2
Level 1
Level 2
Level 1 Finished
Choice 3
Level 1
Level 2
Level 1 Finished
Level 2 Finished
Choice 4
Level 1
Level 2
Level 2 Finished
Choice 5
Level 1
Level 2
Level 2 Finished
Level 1 Finished
C#, Question 18 of 40
Which one of the following operators is overloadable?
Choice 1
&
Choice 2
?:
Choice 3
,
Choice 4
**
Choice 5
[]
C#, Question 19 of 40
Which one of the following code samples writes out "C:\WINNT\System32" to the console?
Choice 1
System.Console.WriteLine("C:\\WINNT\\System32")
Choice 2
System.Console.WriteLine(@"C:\\WINNT\\System32")
Choice 3
System.Console.WriteLine("C:\WINNT\System32")
Choice 4
System.Console.WriteLine("C\:\\WINNT\\System32")
Choice 5
System.Console.WriteLine(@"C\:\WINNT\System32")
C#, Question 20 of 40
Which one of the following types of parameters is considered initially unassigned within a function member?
Choice 1
in
Choice 2
ref
Choice 3
in, out
Choice 4
byref
Choice 5
out
C#, Question 21 of 40
Which code sample below creates a thread-safe ArrayList?
Choice 1
ArrayList al = lock {new ArrayList()};
Choice 2
ArrayList al = ArrayList.Synchronized(new ArrayList());
Choice 3
ArrayList al = fixed {new ArrayList()};
Choice 4
ArrayList al = ArrayList.Mutex {new ArrayList()};
Choice 5
ArrayList al = ArrayList.Locked (new ArrayList());
C#, Question 22 of 40


Sample Code
SqlCommand cmd = new SqlCommand();
using (cmd) {...}
Referring to the above, what method is implicitly called at the end of the "using" statement?
Choice 1
Close
Choice 2
Cancel
Choice 3
Dispose
Choice 4
Destructor
Choice 5
Finalize
C#, Question 23 of 40
Sample Code
public void A()

{

short s = 300;

byte b = (byte)s;

}

Given the above code, what keyword must be used in order to prevent a System.OverflowException from being thrown?
Choice 1
optimize
Choice 2
unchecked
Choice 3
unsafe
Choice 4
nowarn
Choice 5
overflow
C#, Question 24 of 40
Sample Code
public class Publisher {
public event EventHandler OnPublish;
public void DoPublish() {
OnPublish(this, null);
}
}
public class Subscriber {
private Publisher myPublisher;
public Subscriber() {
myPublisher = new Publisher();
(CODE HERE)
}
private void myPublisher_OnPublish(object sender, EventArgs e) {
// handle the event
}
}
Referring to the code above, what line of code at the marker (CODE HERE) binds the OnPublish event of the Publisher class to the private method myPublisher_OnPublish in the Subscriber class?
Choice 1
myPublisher.OnPublish += this.myPublisher_OnPublish();
Choice 2
myPublisher.OnPublish += this.myPublisher_OnPublish(System.EventHandler));
Choice 3
myPublisher.OnPublish += new System.EventHandler(this.myPublisher_OnPublish);
Choice 4
myPublisher.OnPublish += new System.EventHandler(this.myPublisher_OnPublish());
Choice 5
myPublisher.OnPublish += this.myPublisher_OnPublish;
C#, Question 25 of 40
Sample Code
public void A() {
byte a, b, c;
a = 255;
b = 122;
c = (byte)(a & b);
}
Given the above code, what is the value of "c"?
Choice 1
0
Choice 2
122
Choice 3
133
Choice 4
255
Choice 5
377
C#, Question 26 of 40
Sample Code
// critical code section
(CODE HERE)
{
if (myList.Contains(criticalItem)) {
// process the item as required..
myList.Remove(criticalItem);
}
}
Given that myList is an ArrayList, and you have some critical item, what code in place of (CODE HERE) will synchronize the code above to ensure that only one thread at a time accesses "myList"?
Choice 1
synchronize()
Choice 2
lock(Thread.CurrentThread)
Choice 3
lock(myList)
Choice 4
serialize()
Choice 5
serialize(myList)
C#, Question 27 of 40
Sample Code
BOOL PtInRect(const RECT *lprc, POINT pt);
Which one of the following code samples translates the above Win32 API call to its C# equivalent?
Choice 1
[DLLImport("user32")]
public static extern bool PtInRect(Rect, Point p);
Choice 2
[DLLImport("user32")]
public static extern bool PtInRect(ref Rect, ref Point p);
Choice 3
[DLLImport("user32")]
public static extern bool PtInRect(out Rect, Point p);
Choice 4
[DLLImport("user32")]
public static extern bool PtInRect(out Rect, ref Point p);
Choice 5
[DLLImport("user32")]
public static extern bool PtInRect(ref Rect, Point p);
C#, Question 28 of 40
Which two modifiers are required when defining an external method?
Choice 1
public and extern
Choice 2
private and static
Choice 3
declare and extern
Choice 4
static and external
Choice 5
static and extern
C#, Question 29 of 40


Sample Code
internal class Leg {
// Leg members and attributes
}
public class Biped
{
private Leg[] myLeg;
Biped() {
myLeg = new Leg[2];
}
public Leg LeftLeg {
get {
return Leg[0];
}
}
}
Which one of the following statements regarding the above aggregation is correct?
Choice 1
The code is invalid; you cannot return a class via a property.
Choice 2
The code is invalid; a class cannot have public properties.
Choice 3
The code is invalid; classes cannot be declared "internal."
Choice 4
The code is invalid; you cannot return an internal class from a public property.
Choice 5
The code is invalid; you cannot use an internal class within another class.
C#, Question 30 of 40
Sample Code
public class RunStuff {
public void DoSomething() {
// do some process
}
public void DoAsync(int quantity) {
Thread myThread;
(CODE HERE)
myThread = new Thread(myStart);
// do stuff as required
}
}
}
Given the sample above, in the location marked (CODE HERE), which one of the following correctly initializes the ThreadStart object myStart?
Choice 1
ThreadStart myStart = new ThreadStart();
Choice 2
ThreadStart myStart = new ThreadStart(this);
Choice 3
ThreadStart myStart = new ThreadStart(DoSomething());
Choice 4
ThreadStart myStart = new ThreadStart(DoSomething);
Choice 5
ThreadStart myStart = new ThreadStart(myThread);
C#, Question 31 of 40
Sample Code
public class Employee
{
protected double mySalary;
public double Salary {
get { return mySalary; }
set { mySalary = value; }
}
public virtual double Earnings {
get { return mySalary; }
}
}
public sealed class Manager : Employee
{
private double myBonus;
public double Bonus {
get { return myBonus; }
set { myBonus = value; }
}
public override double Earnings {
get { return mySalary + myBonus; }
}
}
Given the above code sample, how do you use an instance of the Manager class polymorphically?
Choice 1
Employee objManager = new Employee();
Choice 2
Manager objManager = new Manager();
Choice 3
Manager objManager = new Employee();
Choice 4
Employee objManager = new Employee(new Manager());
Choice 5
Employee objManager = new Manager();
C#, Question 32 of 40


public class Log {
private string myLogFileName;
public delegate void LogFileMissing(object sender, EventArgs e);
public event LogFileMissing OnLogFileMissing;
public string LogFilename {
get { return myLogFileName; }
set { myLogFileName = value; }
}
public bool LogItem(string item) {
if (!System.IO.File.Exists(myLogFileName)) {
// raise an event that the file is missing
(CODE HERE)
return false;
}
// log the item
// return
return true;
}
}
What code is required at the (CODE HERE) line in the sample above to raise the event OnLogFileMissing?
Choice 1
OnLogFileMissing();
Choice 2
OnLogFileMissing(this, null);
Choice 3
throw new OnLogFileMissing();
Choice 4
return new OnLogFileMissing(this, null);
Choice 5
raiseevent OnLogFileMissing(this, null);
C#, Question 33 of 40
Which one of the following compilers' flag turns on run-time integer range checking?
Choice 1
/overflow
Choice 2
/debug
Choice 3
/rangecheck
Choice 4
/warnaserror
Choice 5
/checked
C#, Question 34 of 40
Sample Code
public void Increase (int i){...}
public void Increase (long i){...}
Given the above overloaded methods, which one of the following results in calling the overloaded Increase method with the long parameter?
Choice 1
Increase(new long {5});
Choice 2
Increase(new System.Int64(5));
Choice 3
Increase(5);
Choice 4
Increase(5L);
Choice 5
Increase(CLng(5));
C#, Question 35 of 40
Sample Code
int i = new System.Int32();
What is the outcome of the above code sample?
Choice 1
An initialized i variable set to null
Choice 2
A boxed instance of i set to null
Choice 3
A new reference type instance of i set to zero
Choice 4
An initialized i variable set to zero
Choice 5
An uninitialized i variable
C#, Question 36 of 40
Which one of the following code samples marks the method with the "STAThread" attribute?
Choice 1
class CSharp {
[STAThread]
public void Main(string[] args) {;}
}
Choice 2
class CSharp {
[Method:STAThread]
public void Main(string[] args) {;}
}
Choice 3
class CSharp {
[Attribute:STAThread]
public void Main(string[] args) {;}
}
Choice 4
class CSharp {
<Attribute:STAThread>
public void Main(string[] args) {;}
}
Choice 5
class CSharp {
<STAThread>
public void Main(string[] args) {;}
}
C#, Question 37 of 40
Sample Code
public class CLSCompliant
{
private uint MethodA() {}
private string MethodB() {}
protected long MethodC() {}
protected unsafe string MethodD() {}
protected static long MethodE() {}
}
What method in the sample code above is NOT CLS-Compliant?
Choice 1
MethodA
Choice 2
MethodB
Choice 3
MethodC
Choice 4
MethodD
Choice 5
MethodE
C#, Question 38 of 40
What symbol do you use to indicate an XML comment on a line?
Choice 1
//
Choice 2
///
Choice 3
// <xml>
Choice 4
#comment
Choice 5
#xml
C#, Question 39 of 40
What modifier do you use in a base class to require any derived class to implement a property?
Choice 1
abstract
Choice 2
must override
Choice 3
sealed
Choice 4
virtual
Choice 5
protected
C#, Question 40 of 40