• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/328

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

328 Cards in this Set

  • Front
  • Back

You want to declare an integer variable called myVar and assign it the value 0. How can you accomplish this?


a. declare myVar as 0;


b. myVar = 0;


c. int myVar = 0


d. int myVar = 0;

d

You need to make a logical comparison where two values must return true in order for your code to execute the correct statement. Which logical operator enables you to achieve this?


a. AND


b. |


c. &


d. &&


c, d

What kind of result is returned in the condition portion of an if statement?


a. Boolean


b. Integer


c. Double


d. String

a

If you want to iterate over the values in an array of integers called arrNumbers to perform an action on them, which loop statement enables you to do this?


a. foreach (int number in arrNumbers)
{
}
b. for each (int number in arrNumbers)
{
}
c. for (int i; each i in arrNumbers; i++)
{
}
d. foreach (number in arrNumbers)
{
}

a

What is the purpose of break; in a switch statement?
a. It causes the program to exit.
b. It causes the code to exit the switch statement.
c. It causes the program to pause.
d. It causes the code to stop executing until the user presses a key on the keyboard.

b

What are the four basic repetition structures in C#?
a. for, foreach, loop, while
b. loop, while, do-for, for-each
c. for, foreach, while, do-while
d. do-each, while, for, do

c

How many times will this loop execute?
int value = 0;
do
{
Console.WriteLine (value);
} while (value > 10);
a. 10 times
b. 1 time
c. 0 times
d. 9 times

b

What are the keywords supported in an if statement?
a. if, else, else-if, return
b. if, else, else if
c. if, else, else if, break
d. if, else, default

b

In the following code sample, will the second if structure be evaluated?
bool condition = true;


if(condition)
if(5 < 10)
Console.WriteLine("5 is less than 10);
a. Yes
b. No

a

Which of the following is NOT a comparison operator?
a. !=
b =
c. >
d. <

b

Which of the following is the correct syntax for executing the following statements in an if statement?
Console.WriteLine("In an if statement");
Console.WriteLine();
a.
bool condition = true;
if(condition)
Console.WriteLine("In an if statement");
Console.WriteLine();
Console.WriteLine("Outside the if statement");
b.
bool condition = true;
if(condition)
{
Console.WriteLine("In an if statement");
Console.WriteLine();
}
Console.WriteLine("Outside the if statement");
c.
bool condition = true;
if(condition)
{
Console.WriteLine("In an if statement");
Console.WriteLine();
Console.WriteLine("Outside the if statement");
}
d.
bool condition = true;
if(condition)
{
Console.WriteLine("In an if statement");
}
Console.WriteLine();
Console.WriteLine("Outside the if statement");

b

Which of the following looping structures must end with a semicolon?
a. for
b. foreach
c. do-while
d. while

c

How do you handle multiple switch statements with one condition in a switch structure?
a. Remove the colon after the condition.
b. Enclose all the code statements you want executed together in curly braces.
c. Create separate switch statements.
d. Omit the break; statement.

d

In a for statement, when does the incrementing of the counter take place?
a. On the last iteration only
b. At the end of each iteration
c. On the second and subsequent iterations only
d. At the end of the iteration and after the comparison

b

When can you assign a value to a variable?
a. During creation only
b. Only runtime in code
c. During declaration
d. Only at design time when writing the code

c

How can you tell when a statement has ended in C#?
a. Using the end of line character
b. Using the carriage return character
c. Using the colon
d. Using the semicolon

d

What is a declaration statement used for in C#?
a. To declare a variable name
b. To declare a variable name and data type
c. To declare the beginning of program execution
d. To declare the beginning of a function

b

Which of these is not a valid C# statement?
a. ;
b. int myVar;
c. string string;
d. Console.WriteLine("Hello world");

c

What is one common characteristic of complex statements?
a. They contain only complex statements.
b. They enclose statements on curly braces.
c. They enclose statements in parentheses.
d. They use tabs and other white space to tell the compiler where statements start and end.

b

In a complex if, else if structure, what keyword can be used to denote the final condition?
a. end if
b. endif
c. default
d. else

d

What is the maximum value you can store in an int data type?
a. Positive infinity
b. 32,167
c. 65,536
d. 4,294,967,296

d

True or false: Double and float data types can store values with decimals.

true

Which declaration can assign the default value to an int type?
a. new int();
b. int myInt = new int();
c. int myInt;
d. int myInt = new int(default);

b

True or false: structs can contain methods.

true

What is the correct way to access the firstName property of a struct named Student?
a. string name = Student.firstName;
b. string name = Student.firstName();
c. string name = Student(firstName);
d. string name = Student.(firstName);

a

In the following enumeration, what will be the underlying value of Wed?
enum Days {Mon = 1, Tue, Wed, Thur, Fri, Sat, Sun};
a. 2
b. 3
c. 4
d. It has no numeric value.

b

What are two methods with the same name but with different parameters?
a. Overloading
b. Overriding
c. Duplexing
d. Duplicate

a

What is the parameter in this method known as?
public void displayAbsoluteValue(int value = 1)
a. Modified
b. Optional
c. Named
d. Default

b

When you create an abstract method, how do you use that method in a derived class?
a. You must overload the method in your derived class.
b. You must override the method in your derived class.
c. Abstract methods cannot be used in derived classes.
d. You need to declare the method as virtual in your derived class.

b

How do you enforce encapsulation on the data members of your class?
a. Create private data members.
b. Create private methods.
c. Use public properties.
d. Use private properties.
e. Use the protected access modifier on methods, properties, and member variables.

a, c

Boxing refers to:
a. Encapsulation
b. Converting a value type to a reference type
c. Converting a reference type to a value type
d. Creating a class to wrap functionality in a single entity

b

What is one advantage of using named parameters?
a. You can pass the arguments in to the method in any order using the parameter names.
b. You can pass in optional arguments as long as you use the parameter names in your arguments.
c. Named parameters make compiling much faster.
d. Name parameters do not affect compile time.

a

What is an advantage of using generics in .NET?
a. Generics enable you to create classes that span types.
b. Generics enable you to create classes that accept the type at creation time.
c. Generics perform better than nongeneric classes.
d. Generics do not use optional parameters.

b

What does the designator indicate in a generic class?
a. It is the parameter for all arguments passed in to the class constructor.
b. It is the parameter designator for the default method of the class.
c. It is a placeholder that will contain the object type used.
d. It is a placeholder that will serve as the class name.

c

How are the values passed in generic methods?
a. They are passed by value.
b. They are passed by reference.
c. They must be encapsulated in a property.
d. They are passed during class instantiation.

b

You want to create a type in your code that stores multiple values of differing types but don’t need the full facilities of a class file. What is the value type that can serve your needs?
a. Array
b. Struct
c. Queue
d. Linked List

b

You can change the increment of Enumerations. True or false?

false

Overloading a method can be accomplished by changing only the order of the parameters. True or false?

false

Optional parameters in a method must exist where in the parameter list?
a. At the beginning
b. At the end
c. After any default parameters
d. Anywhere

b

What modifier is used on the properties of a class?
a. Private
b. Static
c. Public
d. Property

c

To parse a string that might contain a currency value such as $1,234.56, you should pass the Parse or TryParse method which of the following values?
a. NumberStyles.AllowCurrencySymbol
b. NumberStyles.AllowThousands
c. NumberStyles.Currency
d. A combination of all NumberStyles values

c

Which of the following statements is true for widening conversions?
a. Any value in the source type can fit into the destination type.
b. The conversion will not result in loss of magnitude but may result is some loss of precision.
c. An explicit cast is optional.
d. All of the above.

d

Which of the following statements is true for narrowing conversions?
vThe conversion will not result in loss of magnitude but may result is some loss of precision.
b. The source and destination types must be compatible.
c. An explicit cast is optional.
d. A cast can convert a string into an int if the string holds numeric text.

b

Assuming total is a decimal variable holding the value 1234.56, which of the following statements displays total with the currency format $1,234.56?
a. Console.WriteLine(total.ToString());
b. Console.WriteLine(total.ToCurrency
String());
c. Console.WriteLine(total.ToString
("c"));
d. Console.WriteLine(Format("{0:C}",
total);

c

Which of the following statements generates a string containing the text "Veni, vidi, vici"?
a. String.Format("{0}, {1}, {2}",
Veni, vidi, vici)
b. String.Format("{1}, {2}, {3}",
"Veni", "vidi", "vici")
c. String.Format("{2}, {0}, {3}",
"vidi", "Venti", "Veni", "vici")
d. String.Format("{Veni, vidi, vici}")

c

If i is an int and l is a long, which of the following statements is true?
a. i = (int)l is a narrowing conversion.
b. l = (long)i is a narrowing conversion.
c. l = (long)i could cause an integer overflow.
d. The correct way to copy i’s value into l is
l = long.Parse(i).

a

Which of the following methods is the best way to store an integer value typed by the user in a variable?
a. ToString
b. Convert
c. ParseInt
d. TryParse

d

The statement object obj = 72 is an example of which of the following?
a. Explicit conversion
b. Immutable conversion
c. Boxing
d. Unboxing

c

If Employee inherits from Person and Manager inherits from Employee, which of the following statements is valid?
a. Person alice = new Employee();
b. Employee bob = new Person();
c. Manager cindy = new Employee();
d. Manager dan = (Manager)
(new Employee());

a

Which of the following is not a String method?
a. IndexOf
b. StartsWith
c. StopsWith
d. Trim

c

Which of the following techniques does not create a String containing 10 spaces?
a. Set a String variable equal to a literal containing 10 spaces.
b. Use a String constructor passing it an array of 10 space characters.
c. Use a String constructor passing it the space character and 10 as the number of times it should be repeated.
d. Use the String class’s Space method passing it 10 as the number of spaces the string should contain.

d

Which of the following statements can you use to catch integer overflow and underflow errors?
a. checked
b. overflow
c. watch
d. try

a

Which of the following techniques should you use to watch for floating point operations that cause overflow or underflow?
a. Use a checked block.
b. Use a try-catch block.
c. Check the result for the value Infinity or NegativeInfinity.
d. Check the result for Error.

c

Which of the following are narrowing conversions?
a. Converting a byte to an integer
b. Converting a double to a float
c. Converting an integer to a long
d. Converting a float to a double
e. Converting an integer to a float
f. Converting a double to a long
g. Converting a decimal to an integer
h. Converting an integer to a decimal

b, f, g

Which of the following are widening conversions?
a. Converting a byte to an integer
b. Converting a double to a float
c. Converting an integer to a long
d. Converting a float to a double
e. Converting an integer to a float
f. Converting a double to a long
g. Converting a decimal to an integer
h. Converting an integer to a decimal

a, c, d, e, h

If the Manager class inherits from the Employee class, and the Employee and Customer classes both inherit from the Person class, then which of the following are narrowing conversions?
a. Converting a Person to a Manager
b. Converting an Employee to a Manager
c. Converting an Employee to a Person
d. Converting a Manager to a Person
e. Converting a Manager to an Employee
f. Converting a Person to an Employee
g. Converting a Customer to an Employee
h. Converting an Employee to a Customer

a, b, f . (In a sense you could technically consider g and h to be considered narrowing conversions, but actually they are just invalid conversions.)

If the Manager class inherits from the Employee class, and the Employee and Customer classes both inherit from the Person class, then which of the following are widening conversions?
a. Converting a Person to a Manager
b. Converting an Employee to a Manager
c. Converting an Employee to a Person
d. Converting a Manager to a Person
e. Converting a Manager to an Employee
f. Converting a Person to an Employee
g. Converting a Customer to an Employee
h. Converting an Employee to a Customer

c, d, e

During which of the following conversions might there be a loss of precision?
a. Converting an int to a float
b. Converting a float to a long
c. Converting a long to an int
d. Converting an int to a long
e. Converting a float to a decimal
f. Converting a decimal to a float

a, b, e, f

Suppose the Customer class inherits from the Person class, cust is a Customer variable that holds a reference to a Customer object, and person is a Person variable that holds a reference to a Person object. Then which of the following statements will fail at design time?
a. cust = person;
b. cust = person as Customer;
c. cust = (Customer)person;
d. person = cust;
e. person = cust as Person;
f. person = (Person)cust;

a

Suppose the Customer class inherits from the Person class, cust is a Customer variable that holds a reference to a Customer object, and person is a Person variable that holds a reference to a Person object. Then which of the following statements will fail at run time?
a. cust = person;
b. cust = person as Customer;
c. cust = (Customer)person;
d. person = cust;
e. person = cust as Person;
f. person = (Person)cust;

c

Which of the following methods enables a program to parse an integer entered in a TextBox by the user?
a. int.Parse
b. int.TryParse
c. string.Parse
d. string.ParseInt
e. System.Convert.ToInt32

a, b, e

Which of the following string methods breaks a delimited string into pieces?
a. ToArray
b. Split
c. Fields
d. Join

b

Which of the following string methods combines an array of values into a single delimited string?
a. FromArray
b. Fields
c. Join
d. Merge

c

Which of the following statements correctly casts a float into an int?
a. int value = (float)fvalue
b. int value = (int)fvalue
c. int value = ToInt(fvalue)
d. float value = (int)fvalue

b

Which of the following methods does not convert a floating point value into an integer type value?
a. Convert.ChangeType
b. Convert.ToInt16
c. Convert.ToInt32
d. Type.ToInt32

d

Which of the following methods lets you retrieve four 16-bit values that are packed into a 64-byte value returned by an API function?
a. BitConverter.ToInt
b. BitConverter.FromInt64
c. (int)
d. BitConverter.ToInt16

d

Which of the following methods converts a 32-bit integer value into an array of bytes?
a. BitConverter.ToBytes
b. BitConverter.GetBytes
c. BitConverter.ToArray
d. ToArray

b

In the following two statements, where does boxing occur?
int i = 1337;
Console.WriteLine(string.Format("i is: {0}", i));
a. Storing 1337 in an int requires that 1337 be boxed.
b. The string.Format method must box its first parameter.
c. The string.Format method must box its second parameter.
d. The Console.WriteLine method must box the result of the string.Format method.

c

After executing the following two C# statements, which of the following is true?
int i = 10;
object iObject = i;
a. Variable i holds the value 10.
b. Variable iObject holds the value 10.
c. If you later change the value of iObject, the value of i remains unchanged.
d. All the above.

d

When working with API functions, a variable with a name that begins with lpsz has what data type?
a. String
b. 32-bit integer
c. Character array
d. Boolean

a

What purpose does a dynamic data type serve?
a. It enables the program to store more than one kind of data in a variable.
b. It enables the program to convert a value from one type to another automatically without casting.
c. It enables Visual Studio to defer type checking until run time.
d. It prevents type checking.

c

Which of the following methods formats the variable amount as currency?
a. value.ToString("C")
b. value.ToString("$")
c. value.ToString("$#,###.00")
d. value.ToCurrency()

a

Which of the following methods converts the current date into a string that is appropriate for the user’s locale?
a. DateTime.Now.ToString("mm/dd/yy")
b. DateTime.Now.ToString("D")
c. DateTime.Now.ToString("d")
d. DateTime.Now.ToShortDateString()

b, c, d

Which the following statements about the base keyword is false?
a. A constructor can use at most one base statement.
b. A constructor cannot use both a base statement and a this statement.
c. The base keyword lets a constructor invoke a different constructor in the same class.
d. If a constructor uses a base statement, its code is executed after the invoked constructor is executed.

c

Which the following statements about the this keyword is false?
a. A constructor can use at most one this statement.
b. A constructor can use a this statement and a base statement if the base statement comes first.
c. The this keyword lets a constructor invoke a different constructor in the same class.
d. If a constructor uses a this statement, its code is executed after the invoked constructor is executed.

b

Suppose you have defined the House and Boat classes and you want to make a HouseBoat class that inherits from both House and Boat. Which of the following approaches would not work?
a. Make HouseBoat inherit from both House and Boat.
b. Make HouseBoat inherit from House and implement an IBoat interface.
c. Make HouseBoat inherit from Boat and implement an IHouse interface.
d. Make HouseBoat implement both IHouse and IBoat interfaces.

a

Suppose the HouseBoat class implements the IHouse interface implicitly and the IBoat interface explicitly. Which of the following statements is false?
a. The code can use a HouseBoat object to access its IHouse members.
b. The code can use a HouseBoat object to access its IBoat members.
c. The code can treat a HouseBoat object as an IHouse to access its IHouse members.
d. The code can treat a HouseBoat object as an IBoat to access its IBoat members.

b

Which of the following is not a good use of interfaces?
a. To simulate multiple inheritance.
b. To allow the code to treat objects that implement the interface polymorphically as if they were of the interface’s “class.”
c. To allow the program to treat objects from unrelated classes in a uniform way.
d. To reuse the code defined by the interface.

d

Suppose you want to make a Recipe class to store cooking recipes and you want to sort the Recipes by the MainIngredient property. In that case, which of the following interfaces would probably be most useful?
a. IDisposable
b. IComparable
c. IComparer
d. ISortable

b

Suppose you want to sort the Recipe class in question 6 by any of the properties MainIngredient, TotalTime, or CostPerPerson. In that case, which of the following interfaces would probably be most useful?
a. IDisposable
b. IComparable
c. IComparer
d. ISortable

c

Which of the following statements is true?
a. A class can inherit from at most one class and implement at most one interface.
b. A class can inherit from any number classes and implement any number of interfaces.
c. A class can inherit from at most one class and implement any number of interfaces.
d. A class can inherit from any number of classes and implement at most one interface.

c

A program can use the IEnumerable and IEnumerator interfaces to do which of the following?
a. Use MoveNext and Reset to move through a list of objects.
b. Use foreach to move through a list of objects.
c. Move through a list of objects by index.
d. Use the yield return statement to make a list of objects for iteration.

a

Which of the following statements about garbage collection is false?
a. In general, you can’t tell when the GC will perform garbage collection.
b. It is possible for a program to run without ever performing garbage collection.
c. An object’s Dispose method can call GC.SuppressFinalize to prevent the GC from calling the object’s destructor.
d. Before destroying an object, the GC calls its Dispose method.

d

Which of the following statements about destructors is false?
a. Destructors are called automatically.
b. Destructors cannot assume that other managed objects exist while they are executing.
c. Destructors are inherited.
d. Destructors cannot be overloaded.

c

If a class implements IDisposable, its Dispose method should do which of the following?
a. Free managed resources.
b. Free unmanaged resources.
c. Call GC.SuppressFinalize.
d. All of the above.

d

If a class has managed resources and no unmanaged resources, it should do which of the following?
a. Implement IDisposable and provide a destructor.
b. Implement IDisposable and not provide a destructor.
c. Not implement IDisposable and provide a destructor.
d. Not implement IDisposable and not provide a destructor.

b

If a class has unmanaged resources and no managed resources, it should do which of the following?
a. Implement IDisposable and provide a destructor.
b. Implement IDisposable and not provide a destructor.
c. Not implement IDisposable and provide a destructor.
d. Not implement IDisposable and not provide a destructor.

a

1. What keyword do you use to make a constructor invoke a base class constructor?
a. base
b. mybase
c. MyBase
d. this
e. parent
f. constructor

a

2. What keyword do you use to make a constructor invoke a different constructor in the same class?
a. base
b. mybase
c. MyBase
d. this
e. parent
f. constructor

d

3. Suppose the Person class provides two constructors that do different things and you derive the Student class from Person. Suppose you want to make a Student constructor that does what both of the Person constructors do. Which of the following strategies would give you this result?
a. Use multiple base clauses.
b. Move the tasks performed by the Person constructors into methods and invoke them from the Student constructor.
c. Make a third Person constructor that invokes the other two Person constructors. Then have the Student constructor invoke the new Person constructor.
d. Move the tasks performed by the Person constructors into methods, and make a third Person constructor that invokes those methods. Then have the Student constructor invoke the new Person constructor.

b, d

4. Suppose you have created Boat and Car classes, and you want to make an AquaticCar class. Which of the following approaches would work?
a. Make AquaticCar inherit from both Boat and Car.
b. Make AquaticCar inherit from Boat and implement an ICar interface.
c. Make AquaticCar inherit from Car and implement an IBoat interface.
d. Make AquaticCar implement ICar and IBoat interfaces.

b, c, d

5. Suppose you have created a Boat class that contains several hundred lines of code and a Car class that contains only a few dozen lines of code. Now suppose you want to make an AquaticCar class. Rank the following approaches so that the best approach comes first.
a. Make AquaticCar inherit from both Boat and Car.
b. Make AquaticCar inherit from Boat and implement an ICar interface.
c. Make AquaticCar inherit from Car and implement an IBoat interface.
d. Make AquaticCar implement ICar and IBoat interfaces.

b, c, d

6. Suppose you’re building a network application. The Node and Link classes represent a network’s nodes and connecting links. Assuming both of those classes use managed resources, which of the following tasks should the classes do to manage those resources?
a. Implement IDisposable.
b. Provide a Dispose method.
c. Provide a destructor.
d. Implement a Finalize method.

a, b

7. Suppose the Polygon class uses managed resources. Which of the following tasks should the class do to manage its resources?
a. Implement IDisposable.
b. Provide a Dispose method.
c. Provide a destructor.
d. Implement a Finalize method.

a, b

8. Suppose the PriceData class uses unmanaged resources. Which of the following tasks should the class do to manage its resources?
a. Implement IDisposable.
b. Provide a Dispose method.
c. Provide a destructor.
d. Implement a Finalize method.

a, b, c

9. After freeing resources, which of the following should the Dispose method do?
a. Call GC.Finalize.
b. Call GC.SuppressFinalize.
c. Set GC.Finalize = false.
d. Call the object’s destructor.

b

10. Under which of the following circumstances should a program not call an object’s Dispose method?
a. The object was initialized in a using statement.
b. The object has no Dispose method.
c. The object implements IDisposable.
d. The program invoked the object’s destructor.

a, b

11. If you make a Person class and a Student class with the obvious inheritance relationship, then the Person class is which of the following?
a. A derived class
b. A parent class
c. A child class
d. A subclass
e. A superclass

b, e

12. If you make a Person class and a Student class with the obvious inheritance relationship, then the Student class is which of the following?
a. A derived class
b. A parent class
c. A child class
d. A subclass
e. A superclass

a, c, d

13. If you define a class, how many parent classes can you define for it?
a. 0
b. 1
c. 2
d. Any number

a, b

14. If you define a class, how many child classes can you define for it?
a. 0
b. 1
c. 2
d. Any number

d

15. If you define a class, what is the maximum number of interfaces that it can implement?
a. 0
b. 1
c. 2
d. Any number

d

16. If you define an interface, what is the maximum number of classes that can implement it?
a. 0
b. 1
c. 2
d. Any number

d

17. Suppose the IStudent interface defines the method PrintGrades. If the TeachingAssistant class explicitly implements the interface, then which of the following statements is true?
a. TeachingAssistant has a method named PrintGrades.
b. TeachingAssistant has a method named IStudent.PrintGrades.
c. If ta is a TeachingAssistant variable, then the program can call ta.PrintGrades().
d. If ta is a TeachingAssistant variable, then the program can call ta.IStudent.PrintGrades().
e. If ta is an IStudent variable, then the program can call ta.PrintGrades().
f. If ta is an IStudent variable, then the program can call ta.IStudent.PrintGrades().

b, e

18. Suppose the IStudent interface defines the method PrintGrades. If the TeachingAssistant class implicitly implements the interface, then which of the following statements is true?
a. TeachingAssistant has a method named PrintGrades.
b. TeachingAssistant has a method named IStudent.PrintGrades.
c. If ta is a TeachingAssistant variable, then the program can call ta.PrintGrades().
d. If ta is a TeachingAssistant variable, then the program can call ta.IStudent.PrintGrades().
e. If ta is an IStudent variable, then the program can call ta.PrintGrades().
f. If ta is an IStudent variable, then the program can call ta.IStudent.PrintGrades().

a, c, e

19. The Array.Sort method can sort an array of objects if their class implements which of the following interfaces?
a. IComparer
b. IComparable
c. ISortable
d. IEquatable

b

20. A List object’s Contains method returns true if a particular object is in the List but only if the object’s class implements which method?
a. IComparer
b. IComparable
c. ISortable
d. IEquatable

d

Which of the following is a valid delegate definition?
a. private delegate float MyDelegate(float);
b. private delegate MyDelegate(x);
c. private delegate MyDelegate(float x);
d. private delegate void MyDelegate(float x);

d

Which of the following statements is not true of delegate variables?
a. You need to use a cast operator to execute the method to which a delegate variable refers.
b. A struct or class can contain fields that are delegate variables.
c. You can make an array or list of delegate variables.
d. You can use addition to combine delegate variables into a series of methods and use subtraction to remove a method from a series.

a

If the Employee class inherits from the Person class, covariance lets you do which of the following?
a. Store a method that returns a Person in a delegate that represents methods that return an Employee.
b. Store a method that returns an Employee in a delegate that represents methods that return a Person.
c. Store a method that takes a Person as a parameter in a delegate that represents methods that take an Employee as a parameter.
d. Store a method that takes an Employee as a parameter in a delegate that represents methods that take a Person as a parameter.

b

If the Employee class inherits from the Person class, contravariance lets you do which of the following?
a. Store a method that returns a Person in a delegate that represents methods that return an Employee.
b. Store a method that returns an Employee in a delegate that represents methods that return a Person.
c. Store a method that takes a Person as a parameter in a delegate that represents methods that take an Employee as a parameter.
d. Store a method that takes an Employee as a parameter in a delegate that represents methods that take a Person as a parameter.

c

In the variable declaration Action processor, the variable processor represents which of the following?
a. Methods that take no parameters and return an Order object.
b. Methods that take an Order object as a parameter and return void.
c. Methods that take an Order object as a parameter and return an Order object.
d. Methods provided by the Action class that take no parameters and return void.

b

In the variable declaration Func processor, the variable processor represents which of the following?
a. Methods that take no parameters and return an Order object.
b. Methods that take an Order object as a parameter and return void.
c. Methods that take an Order object as a parameter and return an Order object.
d. Methods provided by the Action class that take no parameters and return void.

a

Suppose F is declared by the statement Func F. Then which of the following correctly initializes F to an anonymous method?
a. F = (float x) { return x * x; };
b. F = delegate { return x * x; };
c. F = float Func(float x) { return x * x; };
d. F = delegate(float x) { return x * x; };

d

Suppose the variable note is declared by the statement Action note. Then which of the following correctly initializes note to an expression lambda?
a. note = { return x * x; };
b. note = () { return x * x; };
c. note = () => MessageBox.Show("Hi");
d. note = MessageBox.Show("Hi");

c

Suppose the variable result is declared by the statement Func result. Which of the following correctly initializes result to an expression lambda?
a. result = (float x) => x * x;
b. result = (x) => return x * x;
c. result = x => x * x;
d. Both a and c are correct.

d

Which of the following statements about statement lambdas is false?
a. A statement lambda can include more than one statement.
b. A statement lambda cannot return a value.
c. A statement lambda must use braces, { }.
d. If a statement lambda returns a value, it must use a return statement.

b

Suppose the MovedEventHandler delegate is defined by the statement delegate void MovedEventHandler(). Which of the following correctly declares the Moved event?
a. public MovedEventHandler MovedEvent;
b. public event MovedEventHandler MovedEvent;
c. public event Action MovedEvent;
d. Both b and c are correct.

d

Suppose the Employee class is derived from the Person class and the Person class defines an AddressChanged event. Which of the following should you not do to allow an Employee object to raise this event?
a. Create an OnAddressChanged method in the Person class that raises the event.
b. Create an OnAddressChanged method in the Employee class that raises the event.
c. Make the Employee class call OnAddressChanged as needed.
d. Make the code in the Person class that used to raise the event call the OnAddressChanged method instead.

b

Which of the following statements subscribes the myButton_Click event handler to catch the myButton control’s Click event?
a. myButton.Click += myButton_Click;
b. myButton_Click += myButton.Click;
c. myButton_Click handles myButton.Click;
d. myButton.Click = myButton_Click;

a

Suppose the Car class provides a Stopped event that takes as parameters sender and StoppedArgs objects. Suppose also that the code has already created an appropriate StoppedArgs object named args. Then which of the following code snippets correctly raises the event?
a. if (!Stopped.IsEmpty) Stopped(this, args);
b. if (Stopped) Stopped(this, args);
c. if (Stopped != null) Stopped(this, args);
d. raise Stopped(this, args);

c



guys, we think b may also work.


What do you think? I know c is the standard.

Which of the following statements about events is false?
a. If an object subscribes to an event twice, its event handler executes twice when the event is raised.
b. If an object subscribes to an event twice and then unsubscribes once, its event handler executes once when the event is raised.
c. If an object subscribes to an event once and then unsubscribes twice, its event handler throws an exception when the event is raised.
d. In a Windows Forms application, you can use the Properties window to subscribe and unsubscribe events, and to create empty event handlers.

c

Which of the following statements about inheritance and events is false?
a. A derived class can raise a base class event by using code similar to the following:
if (base.EventName != null) base.EventName(this, args);
b. A derived class cannot raise an event defined in an ancestor class.
c. A class can define an OnEventName method that raises an event to allow derived classes to raise that event.
d. A derived class inherits the definition of the base class’s events, so a program can subscribe to a derived object’s event.

a

Which of the following statements about exception handling is true?
a. You can nest a try-catch-finally block inside a try, catch, or finally section.
b. A try-catch-finally block must include at least one catch section and one finally section.
c. An exception is handled by the catch section that has the most specific matching exception type.
d. The code in a finally section executes if the code finishes without an error or if a catch section handles an exception but not if the code executes a return statement.

a

Which of the following methods can you use to catch integer overflow exceptions?
a. Use a try-catch-finally block.
b. Use a checked block and a try-catch-finally block.
c. Check the Advanced Build Settings dialog’s overflow/underflow box, and use a try-catch-finally block.
d. Either b or c.

d

Which of the following returns true if variable result holds the value float.PositiveInfinity?
a. result == float.PositiveInfinity
b. float.IsInfinity(result)
c. float.IsPositiveInfinity(result)
d. All of the above.

d

Which of the following statements about throwing exceptions is false?
a. If you catch an exception and throw a new one to add more information, you should include the original exception in the new one’s InnerException property.
b. If you rethrow the exception ex with the statement throw, the exception’s call stack is reset to start at the current line of code.
c. If you rethrow the exception ex with the statement throw ex, the exception’s call stack is reset to start at the current line of code.
d. Before a method throws an exception, it should clean up as much as possible, so the calling code has to deal with the fewest possible side effects.

b

Which of the following should you not do when building a custom exception class?
a. Derive it from the System.Exception class, and end its name with Exception.
b. Give it event handlers with parameters that match those defined by the System.Exception class.
c. Make it implement IDisposable.
d. Give it the Serializable attribute.

c

Which of the following statements creates a delegate type named MyFunc that represents a method that takes a parameter that is an array of decimal values and returns a decimal result?
a. delegate decimal(decimal[] values) MyFunc
b. delegate decimal MyFunc(decimal values[])
c. delegate decimal[] MyFunc(decimal values)
d. delegate decimal MyFunc(decimal[] values)

d

If rate is a delegate variable that takes a float parameter and returns a float result, which of the following statements will work assuming x is a float variable?
a. int y = rate(x)
b. float y = rate(x)
c. rate(y, x)
d. double y = rate(x)

b, d

If rate is a delegate variable that refers to the method Rate, then what is the practical difference between calling rate or Rate?
a. You can omit the parameters when calling rate.
b. You must save the result of rate into a variable, but you can use the result of Rate in an expression.
c. You can save Rate in another delegate variable, but you cannot save rate in another delegate variable.
d. There is no practical difference.

d

Which of the following can you do with delegate variables?
a. Make a generic List containing delegate values.
b. Make an array containing delegate values.
c. Use + to add two delegate variables to create a third that represents executing the other two in sequence.
d. Pass the result of executing one delegate variable as a parameter to another delegate variable.

a, b, c, d

Which of the following statements about delegates is true?
a. You can only set a delegate variable equal to a static method.
b. If you set a delegate variable equal to an instance method, then you must set it equal to a specific object’s instance of a method.
c. If you set a delegate variable equal to an instance method, then it executes in the context of the specific object for which it was created.
d. You can set a delegate variable equal to an instance method and then later set it equal to a static method.

b, c, d

Which of the following is a built-in delegate type that represents a method that returns void?
a. Method
b. Static
c. Action
d. Act

c

Which of the following is a built-in delegate type that represents a method that returns a value?
a. Function
b. Func
c. Returns
d. Action

b

If variable note is declared as a delegate variable that takes no parameters and returns no value, which of the following statements could you use to initialize note?
a. note = () => MessageBox.Show("Hi");
b. note = MessageBox.Show("Hi");
c. note(string) = () MessageBox.Show(string);
d. note(s) = () => MessageBox.Show(s);

a

If variable note is declared as a delegate variable that takes a string parameter and returns no value, which of the following statements could you use to initialize note?
a. note = () => MessageBox.Show(string);
b. note = () => MessageBox.Show("Hi");
c. note = (s) => MessageBox.Show(s);
d. note = (string a) => MessageBox.Show(s);

c, d

Which of the following statements about expression lambdas is true?
a. The lambda’s code must be a single C# statement.
b. The lambda can return a value by simply evaluating an expression as in x * x (hence the name expression lambda).
c. The lambda can return a value by using a return statement.
d. The lambda’s code must be enclosed in braces.
e. The lambda must return a value.

a, b

Which of the following statements about statement lambdas is true?
a. The lambda’s code must be a single C# statement.
b. The lambda can return a value by simply evaluating an expression as in x * x.
c. The lambda can return a value by using a return statement.
d. The lambda’s code must be enclosed in braces.
e. The lambda must return a value.

c, d

Which of the following correctly declares a variable notify so that it can hold a reference to a method that takes no parameters and returns no result?
a. Action notify;
b. Action notify;
c. Action<> notify;
d. void notify();

a

Which of the following correctly declares a variable fxy so that it can hold a reference to a method that takes two floats as parameters and returns a float result?
a. Func fxy(float, float);
b. Func float fxy(float, float);
c. Func fxy;
d. float fxy(float, float);

c

When you declare an event, which of the following is always required?
a. The public keyword
b. The event keyword
c. The event’s name
d. A parameter list

c



guys we think it may need to be b also.


What do you think?

When you define an event, Microsoft recommends which of the following?
a. The event handler’s first parameter should be the object raising the event.
b. The event handler’s second parameter should an object of a class derived from EventArgs.
c. The event handler’s third parameter should provide additional information about the event.
d. The name of the second parameter’s class should be the event’s name followed by EventArgs.

a, b, d

If you have defined an appropriate LostEventType delegate type and the LostEventArgs class, which of the following statements could you use to declare the Lost event?
a. event LostEventType Lost;
b. EventHandler Lost;
c. EventHandler Lost;
d. Action Lost;


a, b, d

The finally section in a try-catch-finally block executes under which of the following conditions?
a. The code executes without any exceptions.
b. The code throws an exception and a catch section catches it.
c. The code throws an exception and no catch section catches it.
d. The code executes without any exceptions and executes a return statement.
e. The code throws an exception, a catch section catches it, and that catch section executes a return statement.
f. The code throws an exception, a catch section catches it, and that catch section’s code throws an exception.

a, b, c, d, e, f

If a try-catch-finally block’s catch section throws an exception, which of the following might occur (if the appropriate code is in place)?
a. The block’s finally section executes.
b. A catch section in a method higher up the call stack catches the new exception.
c. Another catch section in the try-catch-finally block catches the exception.
d. The program crashes.

a, b, d

In a try-catch-finally block, the catch sections are examined in which order?
a. The catch sections with the most specific or derived exception class are examined first.
b. The catch sections’ exception classes are considered in alphabetical order.
c. The catch sections’ exception classes are considered in priority order.
d. The catch sections’ exception classes are considered in numeric order.
e. The catch sections are considered in the order in which they appear in the code.

e

Which of the following could happen after a catch section executes (assuming the appropriate code is in place)?
a. The next catch section executes if appropriate.
b. The finally section executes.
c. The program resumes execution after the try-catch-finally block.
d. The try section executes again.

b, c

Which of the following constructs could you use to make a particular piece of code to execute repeatedly until it succeeds?
a. A while loop containing a try-catch-finally block
b. A try-catch-finally block with a while loop in the try section
c. A try-catch-finally block with a while loop in a catch section
d. A try-catch-finally block that contains a catch-while section

a

You are a developer at company xyx. You have been asked to improve the responsiveness of your WPF application. Which solution best fits the requirements?
a. Use the BackgroundWorker class.
b. Use the LongRunningMethod class.
c. Run the method in the UI thread.
d. Use the WorkInBackground class.
e. None of the above.

a

How do you execute a method as a task?
a. Create a new Task object, and then call the Start method on the newly created object.
b. Create the task via the Task.Run method.
c. Create the task via the Task.Factory.StartNew method.
d. All the above.
e. None of the above.

d

Which of the following is not a locking mechanism?
a. Monitor
b. Semaphore
c. Mutex
d. async

d

How can you schedule work to be done by a thread from the thread pool?
a. You create a new object of type ThreadPool, and then you call the Start method.
b. You call the ThreadPool.Run method.
c. You call the ThreadPool.QueueUserWorkItem method.
d. You create a new thread and set its property IsThreadPool to true.
e. You call ContinueWith on a running thread from the thread pool.

c, d

Which of the following are methods of the Parallel class?
a. Run
b. Invoke
c. For
d. ForEach
e. Parallel

b, c, d

Which method can you use to cancel an ongoing operation that uses CancelationToken?
a. Call Cancel method on the CancelationToken
b. Call Cancel method on the CancelationTokenSource object that was used to create the CancelationToken
c. Call Abort method on the CancelationToken
d. Call Abort method on the CancelationTokenSource object that was used to create the CancelationToken

b

Which method would you call when you use a barrier to mark that a participant reached that point?
a. Signal
b. Wait
c. SignalAndWait
d. RemoveParticipant
e. JoinParticipant

c

What code is equivalent with lock(syncObject){…}?
a. Monitor.Lock(syncObject) {…}
b. Monitor.TryEnter(syncObject) {…}
c. Monitor.Enter(syncObject);
try{…}
finally{
Monitor.Exit(syncObject);
}
d. Monitor.Lock(syncObject);
try{…}
catch{
Monitor.Unlock(syncObject);
}

c

In a multithreaded application how would you increment a variable called counter in a lock free manner? Choose all that apply.
a. lock(counter){
counter++;
}
b. counter++;
c. Interlocked.Add(ref counter, 1);
d. Interlocked.Increment (counter);
e. Interlocked.Increment (ref counter);

c, e

Which method will you use to signal and EventWaitHandle?
a. Signal
b. Wait
c. Set
d. Reset
e. SignalAndWait

c

You are given an assignment to create a code generator to automate the task of creating repetitive code. Which namespace contains the types needed to generate code?
a. System.Reflection
b. CodeDom
c. Reflection
d. System.CodeDom

d

Which code can create a lambda expression?
a. delegate x = x => 5 + 5;
b. delegate MySub(double x);
MySub ms = delegate(double y) {
y * y;
}
c. x => x * x;
d. delegate MySub();
MySub ms = x * x;

c

You are consulting for a company called Contoso and are taking over an application that was built by a third-party software company. There is an executable that is currently not working because it is missing a DLL that is referenced. How can you figure out which DLLs the application references?
a. Create an instance of the Assembly class, load the assembly, and iterate through the ReferencedAssemblies property.
b. Create an instance of the Assembly class, load the assembly, and call the GetReferencedAssemblies method.
c. Create an instance of the Assembly class, load the assembly, and iterate through the Modules property.
d. Create an instance of the Assembly class, load the assembly, and call the GetModulesReferenced method.

b

You are a developer for a finance department and are building a method that uses reflection to get a reference to the type of object that was passed as a parameter. Which syntax can be used to determine an object’s type?
a. Type myType = typeof(myParameter);
b. Object myObject =
myParameter.GetType(object);
c. Object myObject = typeof(myParameter);
d. Type myType = myParameter.GetType();

d

You are asked to create a custom attribute that has a single property, called Version, that allows the caller to determine the version of a method. Which code can create the attribute?
a. class MyCustomAttribute :
System.Reflection.Attribute
{
public string Version { get; set; }
}
b. class MyCustomAttribute : System.Attribute
{
public string Version { get; set; }
}
c. class MyCustomAttribute :
System.AttributeUsage
{
public string Version { get; set; }
}
d. class MyCustomAttribute :
System.ClassAttribute
{
public string Version { get; set; }
}

b

Which class in the System.Reflection namespace would you use if you want to determine all the classes contained in a DLL file?
a. FileInfo
b. Assembly
c. Type
d. Module

b

Which method of the Assembly class allows you to get all the public types defined in the Assembly?
a. DefinedTypes
b. Types
c. GetExportedTypes
d. GetModules

c

Which property of the Assembly class returns the name of the assembly?
a. Name
b. FullyQualifiedName
c. Location
d. FullName

d

Which method of the Assembly class returns an instance of the current assembly?
a. GetExecutingAssembly
b. GetAssembly
c. GetCurrentAssembly
d. Assembly

a

Which syntax will Load an Assembly? (Choose all that apply)
a. Assembly.Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
b. Assembly.LoadFrom(@"c:\MyProject\
Project1.dll");
c. Assembly.LoadFile(@"c:\MyProject\
Project1.dll");
d. Assembly.ReflectionOnlyLoad(("System.Data,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089");

a, b, c, d

Which method should you call if you want the .NET Framework to look in the load-context to load an Assembly?
a. ReflectionOnlyLoad
b. LoadFrom
c. Load
d. LoadFromContext

c

Which method should you call if you want the .NET Framework to look in the load-from context?
a. ReflectionOnlyLoad
b. LoadFrom
c. Load
d. LoadFromContext

b

Which line creates an instance of a DataTable using reflection?
a. myAssembly.CreateInstance
(“System.Data.DataTable”);
b. DataTable.GetType();
c. typeof(“System.Data.DataTable”);
d. myType.CreateInstance
(“System.Data.DataTable”);

a

Which class would you create if you wanted to determine all the properties contained in a class using reflection?
a. Assembly
b. Class
c. Property
d. Type

d

How can you determine if a class is public or private?
a. Create an instance of the Type class using the typeof keyword and then examine the IsPublic property of the Type variable.
b. Create an instance of the Type class using the typeof keyword and then examine the IsPrivate property of the Type variable.
c. Create an instance of the class within a try catch block and catch the exception if you cannot create an instance of the class.
d. Create an instance of the class and check the IsPublic property.

a

Which class in the System.Reflection namespace is used to represent a field defined in a class?
a. PropertyInfo
b. FieldInfo
c. Type
d. EventInfo

b

Which property of the Type class can you use to determine the number of dimension for an array?
a. GetDimension
b. GetRank
c. GetDimensions
d. GetArrayRank

d

Which statement will returns a private, instance field called "myPrivateField" using reflection? Assume the myClass variable is an instance of a class.
a. myClass.GetType().GetField
(“myPrivateField”, BindingFlags.NonPublic |
BindingFlags.Instance)
b. myClass.myPrivateField
c. myClass.GetType().GetField
(“myPrivateField”)
d. myClass. GetType().GetField(“myPrivateField”,
BindingFlags.NonPublic &
BindingFlags.Instance)

a

Which method of the MethodInfo class can be used to execute the method?
a. Execute
b. Invoke
c. Call
d. Load

b

Which statement uses reflection to execute the method and passes in two parameters given the following code block?
MyClass myClass = new MyClass();
MethodInfo myMethod = typeof(MyClass).GetMethod(“Multiply”);
a. myMethod.Execute(myClass, new object[] { 4,
5 });
b. myMethod.Execute(MyClass, new object[] { 4,
5 });
c. myMethod.Invoke(myClass, new object[] { 4,
5 });
d. myMethod.Invoke(MyClass, new object[] { 4,
5 });

c

Which class name follows the standard naming convention for a custom attribute class?
a. AttributeMyCustom
b. MyCustomAttribute
c. MyCustom
d. MyCustom_Attribute

b

How can you limit the scope of a custom attribute that you are creating so that it can be used only by a class?
a. Set the custom attribute’s TargetLevel property to Class.
b. Add the following attribute above the custom attribute’s class declaration:
[System.AttributeUsage(AttributeTargets.Class)]
c. Set the custom attribute’s TargetLevel attribute to Class.
d. Set the custom attribute’s Scope property to Class.

b

If you have created a custom attribute class called DataMappingAttribute and have used it in a class called Person, which statement will return all the DataMappingAttributes that have been applied to the Person class?
a. typeof(DataMappingAttribute).
GetCusomAttributes(typeof(Person),
false);
b. typeof(Person).GetAttributes(typeof
(DataMappingAttribute), false);
c. typeof(DataMappingAttribute).
GetAttributes(typeof(Person), false);
d. typeof(Person).GetCusomAttributes
(typeof(DataMappingAttribute), false);

d

Which class in the CodeDOM is the top-level class that is the container for all other objects within the class?
a. CodeNamespace
b. CodeCompileUnit
c. CodeConstructor
d. CodeDOMProvider

b

Which statement generates a namespace statement using the CodeDOM?
a. Namespace namespace = new
Namespace("MyNamespace");
b. string namespace =
Namespace.Create("MyNamespace");
c. CodeNamespace codeNamespace =
new CodeNamespace("MyNamespace");
d. string namespace =
CodeNamespace.Create("MyNamespace");

c

Which class in the CodeDOM is used to create a statement that declares a class?
a. CodeClassDeclaration
b. CodeCompileUnit
c. CodeTypeDeclaration
d. CodeClass

c

Which statement should be added to the following block of code to set a field’s type to a double using the CodeDOM?
CodeMemberField xField = new CodeMemberField();
xField.Name = "x";
a. xField.Type = new CodeTypeReference(typeof(double));
b. xField.Type = double;
c. xField.Type = typeof(double));
d. xField.Type = new double();

a

Which property of the CodeMemberProperty class should be set to true to tell the compiler to generate a set accessor using the CodeDOM?
a. Set
b. HasSet
c. CreateSet
d. GenerateSet

b

Which class in the CodeDOM is used to represent either the this keyword in C# or the Me keyword in VB.NET?
a. CodeMeReference
b. CodeThisReference
c. CodeMeReferenceExpression
d. CodeThisReferenceExpression

d

Which property of the CodeConditionStatement is used to add statements to the true path of logic using the CodeDOM?
a. TrueConditions
b. TrueStatements
c. TrueCodeStatements
d. TrueExpressions

b

Which class in the CodeDOM is used to call a method?
a. CodeMethodInvoke
b. CodeMethodInvokeExpression
c. CodeMethodCall
d. CodeMethodCallExpression

b

Which class in the CodeDOM is used to generate a class file?
a. CodeDOMProvider
b. CodeDOMTextWriter
c. CodeDOMClassWriter
d. CodeDOMGenerator

a

You are looking at the output of a file generated using the CodeDOM. The file is in C# and you notice that the brackets for all your methods are not on separate lines. Which property of the CodeGeneratorOptions class can you use to force the brackets to be on separate lines, and what should the property be set to?
a. BracketStyle = BracketStyle.Separate
b. BracingStyle = BracingStyle.Separate
c. BracingStyle = "C"
d. BracketStyle = "C"

c

Which statement is a valid expression lambda?
a. x => x * y
b. x => x * x
c. x => { int y; y = x * x; }
d. x => y

b (Answer b is an expression lamba; answer c is a statement lambda)

Which statement should be on the left side of a goes to operator if you want to pass two parameters to a lambda expression?
a. { x, y }
b. ( x, y )
c. { x => y }
d. ( x => y )

b

What is the correct delegate declaration for the following method?
void int Multiply(int x, int y)
a. int MyDelegate(int a, int b) as delegate;
b. delegate int MyDelegate(int a, int b);
c. int Multiply(int x, int y);
d. delegate void MyDelegate(void a, void b);

b

True or false? You can reference local variables that are not passed as parameters in an anonymous method.
a. True
b. False

a

Which method of the CodeDOMProvider generates a code file?
a. GenerateCode
b. GenerateCodeFileFromCompileUnit
c. GenerateFileFromCompileUnit
d. GenerateCodeFromCompileUnit

c

Which class in the CodeDOM is used to create a method declaration statement?
a. MethodDeclaration
b. CodeMethodDeclaration
c. CodeMemberMethod
d. CodeMemberDeclaration

c

Which is the => syntax referred to as in a lambda expression?
a. The parameter operator
b. The goes to operator
c. The lambda operator
d. The expression operator

b

Which object does the variable mySet inherit from?
Int[] mySet = new int[5];
a. System.Collection
b. System.Collection.List
c. System.Array
d. None, this is a value type.

c

Which type should you use to store objects of different types but do not know how many elements you need at the time of creation?
a. Collection
b. List
c. Stack
d. ArrayList

d

If you create a custom class that is going to be used as elements in a List object and you want to use the Sort method of the List object to sort the elements in the array, what steps must you take when coding the custom class?
a. Inherit from the ICompare interface.
Implement the Comparable method.
b. Inherit from the IComparable interface.
Implement the CompareTo method.
c. Inherit from the System.Array class.
Override the Sort method.
d. Inherit from the List class.
Implement the Sort method.

b

Which collection would you use if you need to process the items in the collection on first-in-first-out order?
a. HashTable
b. Queue
c. Stack
d. List

b

Which collection would you use if you need to process the items in the collection on a last-in-first-out order?
a. HashTable
b. Queue
c. Stack
d. List

c

Which collection would you use if you need to quickly find an element by its key rather than its index?
a. Dictionary
b. List
c. SortedList
d. Queue

a, c

Which ADO.NET object is used to connect to a database?
a. Database
b. Connection
c. Command
d. DataAdapter

b

Which properties of an ADO.NET Command object must you set to execute a stored procedure?
a. CommandType
StoredProcedureName
Parameters
b. IsStoredProcedure
CommandType
StoredProcedureName
Parameters
c. CommandType
CommandText
Parameters
d. IsStoredProcedure
CommandText
Parameters

c

Which Command object’s method would you use to execute a query that does not return any results?
a. ExecuteNonQuery
b. ExecuteDataReader
c. ExecuteScalar
d. Execute

a

Which Command object’s method would you use to execute a query that returns only one row and one column?
a. ExecuteNonQuery
b. ExecuteDataReader
c. ExecuteScalar
d. Execute

c

Which ADO.NET object is a forward only cursor and is connected to the database while the cursor is open?
a. DBDataReader
b. DataSet
c. DataTable
d. DataAdapter

a

Which ADO.NET Command object’s property would you use when a query returns the SUM of a column in a table?
a. ExecuteNonQuery
b. ExecuteDataReader
c. ExecuteScalar
d. Execute

c

Which ADO.NET object is a fully traversable cursor and is disconnected from the database?
a. DBDataReader
b. DataSet
c. DataTable
d. DataAdapter

c

Which method of a DataAdapter is used to populate a DataSet?
a. Populate
b. Fill
c. Load
d. DataSets[0].Fill

b

Which property of an ADO.NET DataAdapter is used to insert records in a database?
a. InsertText
b. InsertType
c. InsertCommand
d. InsertDataTable

c

Which ADO.NET Command object’s property would you use when a query returns the SUM of a column in a table?
a. ExecuteNonQuery
b. ExecuteDataReader
c. ExecuteScalar
d. Execute

c

When using the ADO.NET Entity Framework you create a Model that represents the object in the database. What class does the Model inherit from?
a. DBContext
b. DBSet
c. Model
d. Connection

a

How are stored procedures represented in the ADO.NET Entity Framework?
a. A class is created with the same name as the stored procedure, and the Execute method is implemented.
b. A method is added to the Model that is the same name as the stored procedure.
c. Stored procedures cannot be called from the ADO.NET Entity Framework.
d. A method is created in the entity class for the table in the stored procedure.

b

Which code uses the ADO.NET Entity Framework to add a record to the database?
a.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.Categories.Add(category);
db.SaveChanges();
}
b.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.Categories.Add(category);
db.InsertRecords ();
}
c.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.Categories.Insert (category);
db.SaveChanges();
}
d.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.Categories.Insert(category);
db.InsertRecords();
}

a

Which code uses the ADO.NET Entity Framework to update a record in the database?
a.
Category category = db.Categories.First(c => c.CategoryName == "Alcohol");
category.Description = "Happy People";
db.UpdateRecords ();
b.
Category category = db.Categories.First(c => c.CategoryName == "Alcohol");
category.Description = "Happy People";
db.Categories.UpdateRecords();


c.
Category category = db.Categories.First(c => c.CategoryName == "Alcohol");
category.Description = "Happy People";
db.SaveChanges();


d.
Category category = db.Categories.First(c => c.CategoryName == "Alcohol");
category.Description = "Happy People";
db.Categories.SaveChanges();

c

Which code uses the ADO.NET Entity Framework to delete a record?
a.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = db.Categories.First(c => c.CategoryName ==
"Alcohol");
db.Categories.Delete(category);
}
b.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = db.Categories.First(c => c.CategoryName ==
"Alcohol");
db.Categories.Remove(category);
db.SaveChanges();
}
c.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = db.Categories.First(c => c.CategoryName ==
"Alcohol");
db.Categories.Remove(category);
db.DeleteRecords();
}
d.
using (NorthwindsEntities db = new NorthwindsEntities())
{
Category category = db.Categories.First(c => c.CategoryName ==
"Alcohol");
db.Delete(category);
}

b

When you create a WCF Data Service, what two steps must you take to expose an Entity?
a. Set the type in the DataService< T > class declaration.
b. Add the following line to the InitializeService method:
config.SetEntitySetAccessRule("Categories", EntitySetRights.AllRead );
c. Add the following line to the InitializeService method:
config.SetEntitySetsAccessRule("Categories", EntitySetRights.AllRead );
d. Add the following line to the InitializeService method:
config.SetServiceOperationAccessRule("Categories", EntitySetRights.AllRead );

a, b

What is the default form of the data returned from a WCF Data Service?
a. JSON
b. HTML
c. ATOM XML
d. XSLT

c

What querystring parameter can you use to select only records from the Categories table where the CategoryName is equal to Beverages?
a. $filter=CategoryName='Beverages'
b. $select=CategoryName='Beverages'
c. $where=CategoryName='Beverages'
d. $filter=CategoryName eq 'Beverages'

d

What querystring can you use to select the Category record with a primary key of 1?
a. /Categories/$select=CategoryId=1
b. /Categories(1)
c. /Categories/$where=CategoryId=1
d. /Categories/$filter=CategoryId eq 1

b, d

What querystring parameter can you use to select the CategoryName for the record with a primary key of 1?
a. /Categories(1)/$select=CategoryName
b. /Categories/$where=CategoryId=
1&$select=CategoryName
c. /Categories(1)/CategoryName
d. /Categories/CategoryId=
1&CategoryName=$select

a, c

Which code creates an instance of the NorthwindsEntities data model that is exposed as a WCF Data Service?
a.
NorthwindsEntities db = new NorthwindsEntities(("http://localhost:8999/NorthwindsService.svc/"));
b.
NorthwindsEntities db = new NorthwindsEntities(new
Uri("http://localhost:8999/NorthwindsService.svc/"));
c.
NorthwindsEntities db = new NorthwindsEntities();
d.
NorthwindsEntities db = new NorthwindsEntities(new
Service("http://localhost:8999/NorthwindsService.svc/"));

b

Which code adds a record using WCF Data Services?
a.
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.Categories.Add(category);
DataServiceResponse response = db.SaveChanges();
b.
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.AddToCategories(category);
DataServiceResponse response = db.SaveChanges();
c.
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.Categories.Add(category);
DataServiceResponse response = db.Update();
d.
Category category = new Category()
{
CategoryName = "Alcohol",
Description = "Happy Beverages"
};


db.AddToCategories(category);
DataServiceResponse response = db.Update();

b

Which code is used to update a record using a WCF Data Service?
a.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();

category.Description = "Happy People";


db.UpdateObject(category);
b.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();

category.Description = "Happy People";


db.SaveChanges();
c.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();

category.Description = "Happy People";


db.UpdateObject(category);
db.SaveChanges();
d.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();

category.Description = "Happy People";


db.UpdateObject(category);
db.Update();

c

Which code can delete a record using a WCF Data Service?
a.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();
db.DeleteObject(category);
b.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();
db.Delete(category);
c.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();
db.DeleteObject(category);
db.Update ();
d.
Category category = db.Categories.Where(c => c.CategoryName ==
"Alcohol").FirstOrDefault();
db.DeleteObject(category);
db.SaveChanges();

d

Which object is a static class that enables you to perform operations on a file?
a. FileInfo
b. File
c. FileObject
d. FileHelper

b

What method on the DirectoryInfo object can return all subdirectories within the directory?
a. GetFolders
b. GetSubFolders
c. GetDirectories
d. GetSubDirectories

c

Which class is used to read and write data to and from a file?
a. FileStream
b. BufferedStream
c. MemoryStream
d. PipeStream

a

Which FileMode enumeration would you use if you want to create a new file or overwrite an existing file?
a. FileMode.CreateNew
b. FileMode.Create
c. FileMode.Open
d. FileMode.CreateOrOpen

b

Which FileMode enumeration would you use if you want to create a new file to open the file if it exists?
a. FileMode.Append
b. FileMode.CreateNew
c. FileMode.CreateOrOpen
d. FileMode.OpenOrCreate

a, d

Which FileMode enumeration would you use if you want to create a new file or throw an exception if the file already exists?
a. FileMode.CreateNew
b. FileMode.Create
c. FileMode.Open
d. FileMode.OpenOrCreate

a

Which FileAccess enumeration would you use if you want to read and write to a file?
a. FileAccess.Read
b. FileAccess.Write
c. FileAccess.WriteRead
d. FileAccess.ReadWrite

d

Which FileShare enumeration would you use if you do not want to allow any other process to access the file while you have it open?
a. FileShare.Read
b. FileShare.ReadWrite
c. FileShare.NoAccess
d. FileShare.None

d

Which method of the StreamReader object reads the next character in the file?
a. Read
b. ReadBlock
c. ReadLine
d. ReadChar

a

Which keyword is used to modify a method that contains a call to an asynchronous method?
a. await
b. async
c. wait
d. thread

b

Which keyword is used to call a method and suspend execution until that method returns?
a. await
b. async
c. wait
d. thread

a

Which object serialized an object to binary format?
a. BinarySerializer
b. BinaryFormatter
c. BinaryStream
d. BinaryWriter

b

Which attribute must be set for a class for it to be serialized?
a. [Serialize]
b. [Serialized]
c. [Serializable]
d. [SerializeFormat=Binary]

c

Which code can serialize the Person object in binary format?
a.
ISerializable serializer = new BinarySerializer();
Stream stream = new FileStream("Person.bin", FileMode.Create,
FileAccess.Write, FileShare.None);
serializer.Serialize(stream, person);
stream.Close();
b.
Stream stream = new FileStream("Person.bin", FileMode.Create,
FileAccess.Write, FileShare.None);
Person.Serialize(stream, person);
stream.Close();
c.
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("Person.bin", FileMode.Create,
FileAccess.Write, FileShare.None);
formatter.Serialize(stream, person);
stream.Close();
d.
Stream stream = new BinaryStream("Person.bin", FileMode.Create,
FileAccess.Write, FileShare.None);
stream.Serialize(person);
stream.Close();

c

Which class can you use to serialize an object to XML?
a. BinarySerializer
b. XMLSerializer
c. XMLFormatter
d. XMLWriter

b

Which attribute can you use to prevent a property from being serialized to XML?
a. [XmlPrevent]
b. [XmlHide]
c. [XmlHide=true]
d. [XmlIgnore]

d

Which attribute must you place before the declaration of a class to allow it be serialized as JSON?
a. [Serializable]
b. [JsonSerializable]
c. [DataContract]
d. [Serialize=JSON]

c

Which attribute must be placed before a property for it to be serialized as JSON?
a. [Serialize]
b. [DataMember]
c. [SerializeProperty]
d. [DataProperty]

b

Which object is used to serialize an object to JSON?
a. JsonSerializer
b. JsonFormatter
c. DataContractJsonSerializer
d. DataContractJsonFormatter

c

Which attribute must you use if you want to perform custom serialization?
a. OnDeserializedAttribute
b. OnDeserializingAttribute
c. OnSerializedAttribute
d. OnSerializingAttribute

a, b, c, d

Which interface can you implement if you want to implement custom serialization?
a. ISerializable
b. ISerial
c. ICustomSerializable
d. ICustomSerial

a

Which two steps must you take to implement custom serialization when implementing the ISerializable interface?
a. Create a constructor that takes the SerializationInfo and StreamingContext objects as parameters.
b. Override the Serialize method.
c. Override the DeSerialize method.
d. Override the GetObjectData method.

a, d

Which answer has the correct order of keywords for a LINQ query expression?
a. select, from, where
b. where, from, select
c. from, where, select
d. from, select, where

c

Which where clause can select all integers in the myList object that are even numbers given the following from clause?
from i in myList
a. where myList.Contains(i % 2)
b. where i % 2 = 0
c. where i % 2 == 0
d. where i % 2 equals 0

c

Which line of code executes the LINQ query?
1. var result = from i in myArray
2. order by i
3. select i
4. foreach(int i in result)
5. { …}
a. Line 1
b. Line 2
c. Line 3
d. Line 4

d

Which method can you use to find the minimum value in a sequence?
a. (from i in myArray select i).Min()
b. from i in myArray select Min(i)
c. from Min(i) in myArray select i
d. from i in Min(myArray) select I

a

Which methods can you use to find the first item in a sequence?
a. Min
b. First
c. Skip
d. Take

b, d

Which where clause returns all integers between 10 and 20?
a. where i >= 10 and i <= 20
b. where i >= 10 && i <= 20
c. where i gt 10 and i lt 20
d. where i gt 10 && i lt 20

b

Which clause orders the state and then the city?
a. orderby h.State
orderby h.City
b. orderby h.State thenby h.City
c. orderby h.State, h.City
d. orderby h.State, thenby h.City

c

Which statement selects an anonymous type?
a. select { h.City, h.State }
b. select h
c. select new { h.City, h.State }
d. select h.City, h.State

c

Which on statement joins two sequences on the StateId property?
a. on e.StateId equals s.StateId
b. on e.StateId = s.StateId
c. on e.StateId == s.StateId
d. on e.StateId.Equals(s.StateId)

a

Which two keywords must you use in a join clause to create an outer join?
a. groupby, into
b. into, DefaultIfEmpty
c. new, DefaultIfEmpty
d. into, groupby

b

Which join clause uses a composite key?
a. on new { City = e.City, State = e.State }
equals new { City = h.City, State =
h.State }
b. on e.City = h.City && e.State = h.State
c. on e.City = h.City and e.State = h.State
d. on e.City equals h.City and e.State
equals h.State

a

Which statement groups a sequence by the State property?
a. groupby e.State
b. group e.State
c. group e by e.State
d. groupby e.State in states

c

Which answers return the count of all even numbers?
a. myArray.Where(i => i % 2 == 0).Count()
b. myArray.Count(i => i % 2 == 0)
c. myArray.Count(i =>).Where(i % 2 == 0)
d. myArray.Count(Where(i => i % 2))

a, b

Which types can be queried using LINQ?
a. IEnumerable
b. int
c. IQueryable
d. List

a, c, d

Which keyword is used to create an implicitly typed variable?
a. type
b. object
c. var
d. implicit

c

Which syntax is a valid from clause in a LINQ query expression?
a. from myArray
b. select * from myArray
c. from a in myArray
d. from * in myArray

c

Which statement is a proper where clause in a LINQ query expression?
a. where i = 5 or i = 6
b. where i == 5 || i == 6
c. where i = 5 || I = 6
d. where i == 5 or i == 6

b

Which answer contains the predicate clause?
a. var evenNumbers = from i in myArray
b. where i % 2 == 0
c. select i
d. orderby I

b

True or false? The where clause can appear anywhere in a LINQ query expression except the first and last clause?
a. True
b. False

a

Which clause in a LINQ query expression can sort the results?
a. sortby
b. orderby
c. order by
d. sort by

b

What is selecting a limited number of properties or transforming the result into a different type referred to as?
a. Implicitly typed variables
b. Reflection
c. Predicate
d. Projection

d

What is an object that contains read-only properties that is not explicitly declared referred to as?
a. Implicitly typed variable
b. Anonymous type
c. LINQ query expression
d. Dynamic variable

b

Which type does a groupby clause return from a LINQ query expression?
a. IGrouping
b. IGrouping
c. IGroupedBy
d. IGroupedBy

a

Which method-based query is used to filter a sequence?
a. Filter
b. Search
c. GoesTo
d. Where

d

Which method-based query can be used to sort elements in a sequence descending?
a. SortByDescending
b. OrderByDescending
c. SortDescending
d. OrderDescending

b

Which method-based query can be used to project the results of a sequence?
a. Select
b. Where
c. Count
d. First

a

Which method-based query would you use to perform an outer join on two sequences?
a. Join
b. OuterJoin
c. GroupJoin
d. SelectMany

c

15. Which method-based query can be used to group elements of a sequence?
a. Group
b. GroupBy
c. GroupCount
d. GroupOver

b

Which method-based query can concatenate two sequences similar to how a UNION clause works in a SQL statement?
a. GroupJoin
b. Union
c. Join
d. Concat

d

Which method-based query can be used return all elements in a sequence after a specified index?
a. Skip
b. Take
c. Select
d. Where

a

Which method-based query limits the number of elements returned from a sequence?
a. Skip
b. Take
c. Select
d. GroupBy

b

Which class can be used to transform a sequence to XML?
a. XML
b. XElement
c. Element
d. XDocument

b

Which method-based query can be used to select a unique list of elements in a sequence?
a. Unique
b. Select
c. Distinct
d. Where

c

If the user is typing data into a TextBox and types an invalid character, which of the following actions would be inappropriate for the program to take?
a. Change the TextBox’s background color to indicate the error.
b. Silently discard the character.
c. Display an asterisk next to the TextBox to indicate the error.
d. Display a message box telling the user that there is an error.

d

If the user types an invalid value into a TextBox and moves focus to another TextBox, which of the following actions would be inappropriate for the program to take?
a. Force focus back into the TextBox that contains the error.
b. Change the first TextBox’s background color to indicate the error.
c. Change the first TextBox’s font to indicate the error.
d. Display an asterisk next to the first TextBox to indicate the error.

a



guys, we are not real sure about this answer. What do you think?

If the user enters some invalid data on a form and then clicks the form’s Accept button, which of the following actions would be appropriate for the program take?
a. Change the background color of TextBoxes containing invalid values to indicate the errors.
b. Display a message box telling the user that there is an error.
c. Do not close the form until the user corrects all the errors.
d. All the above.

d

Which of the following methods returns true if a regular expression matches a string?
a. Regex.Matches
b. Regex.IsMatch
c. Regexp.Matches
d. String.Matches

b

Which of the following regular expressions matches the Social Security number format ###-##-#### where # is any digit?
a. ^###-##-####$
b. ^\d3-\d2-\d4$
c. ^\d{3}-\d{2}-\d{4}$
d. ^[0-9]3-[0-9]2-[0-9]4$

c

Which of the following regular expressions matches a username that must include between 6 and 16 letters, numbers, and underscores?
a. ^[a-zA-Z0-9_]?{6}$
b. ^[a-zA-Z0-9_]{6,16}$
c. ^[A-Z0-9a-z_]?$
d. ^\w{16}?$

b

Which of the following regular expressions matches license plate values that must include three uppercase letters followed by a space and three digits, or three digits followed by a space and three uppercase letters?
a. (^\d{3} [A-Z]{3}$)|(^[A-Z]{3}
\d{3}$)
b. ^\d{3} [A-Z]{3} [A-Z]{3} \d{3}$
c. ^\w{3} \d{3}|\d{3} \w{3}$
d. ^(\d{3} [A-Z]{3})?$

a

Which of the following statements about assertions is true?
a. The Debug.Assert method is ignored in release builds.
b. The program must continue running even if a Debug.Assert method stops the program.
c. When an assertion fails in debug builds, the Debug.Assert method lets you halt, debug the program, or continue running.
d. All the above.

d

Which of the following statements about the Debug and Trace classes is true?
a. The Debug class generates messages if DEBUG is defined. The Trace class generates messages if both DEBUG and TRACE are defined.
b. The Debug class generates messages if DEBUG is defined. The Trace class generates messages if TRACE is defined.
c. The Debug and Trace classes both generate messages if DEBUG is defined.
d. The Debug and Trace classes both generate messages if TRACE is defined.

b

Which of the following statements about builds is true by default?
a. Debug builds define the DEBUG symbol.
b. Debug builds define the TRACE symbol.
c. Release builds define the DEBUG symbol.
d. Release builds define the TRACE symbol.
e. Release builds define the RELEASE symbol.

a, b, d

Which of the following statements about PDB files is false?
a. You need a PDB file to debug a compiled executable.
b. You can use a PDB file to debug any version of a compiled executable.
c. The “full” PDB file contains more information than a “pdb-only” PDB file.
d. If you set the PDB file type to None, Visual Studio doesn’t create a PDB file.

b

Which of the following statements about tracing and logging is false?
a. Tracing is the process of instrumenting a program to track what it is doing.
b. Logging is the process of making the program record key events in a log file.
c. You can use DEBUG and TRACE statements to trace or log a program’s execution.
d. A program cannot write events into the system’s event logs, so you can see them in the Event Viewer.

d

Which of the following methods would probably be the easiest way to find bottlenecks in a program if you had no idea where to look?
a. Use an automatic profiler.
b. Instrument the code by hand.
c. Use performance counters.
d. Set breakpoints throughout the code and step through execution.

a

What of the following is the best use of performance counters?
a. To determine which of a program’s methods use the most CPU time.
b. To determine how often a particular operation is occurring on the system as a whole.
c. To determine how often a particular operation is occurring in a particular executing instance of a program.
d. To find the deepest path of execution in a program’s call tree.

b

Which of the following events occurs if a program sets the Validating event’s e.Cancel value to true?
a. The user cannot move focus out of the control that raised the event.
b. The control that raised the event displays an error indicator.
c. The computer beeps.
d. The form refuses to close.

a, d

Which of the following can a program use to verify that the user has entered a value in the FirstNameTextBox.
a. if (FirstNameTextBox.IsEmpty)
b. if (FirstNameTextBox.IsBlank)
c. if (FirstNameTextBox.Text.Length == 0)
d. if (FirstNameTextBox.Text.IsBlank)
e. if (FirstNameTextBox.Text == "")

c, e

3. Which of the following methods should you use to verify that a TextBox should contain an integer value?
a. IsInt
b. string.IsInteger
c. int.Parse
d. int.TryParse

d

How could you determine that values such as “-.” are valid initial pieces of a valid floating point value?
a. Use float.Parse.
b. Use float.TryParse.
c. Add 0 before the value and use float.TryParse to see if the result is valid.
d. Add 0 after the value and use float.TryParse to see if the result is valid.

d

Which of the following string methods returns the index of the first occurrence of a string within another string?
a. Position
b. PositionOf
c. IndexOf
d. Pos

c

Which of the following string methods can you use to remove a particular character from a string?
a. Remove
b. Replace
c. ReplaceString
d. Substring

b

Which of the following string methods can you use to remove characters in a particular location in a string?
a. Remove
b. Replace
c. ReplaceString
d. Substring

a

Which of the following string methods can you use to get characters from a particular position in a string?
a. Remove
b. Replace
c. ReplaceString
d. Substring

d

Which of the following regular expression methods returns true if a string matches a particular pattern?
a. Matches
b. Match
c. IsMatch
d. HasMatch

c

Which of the following regular expressions matches any number of vowels?
a. [aeiouAEIOU]
b. [aeiouAEIOU]*
c. [aeiouAEIOU]+
d. /v*

b

Which of the following regular expressions matches between 1 and 3 uppercase letters?
a. [A-Z:1-3]
b. [A-Z]{1,3}
c. [AZ]+++
d. [A-Z]{1-3}

b

Which of the following regular expressions matches either of the strings true or false?
a. (true|false)
b. (true)(false)
c. (true,false)
d. (true)or(false)

a

Which of the following matches a 7-digit U.S. phone number?
a. [0-9]{3}-[0-9]{4}
b. ^[0-9]{3}-[0-9]{4}$
c. \d{3}-\d{4}
d. ^\d{3}-\d{4}$

b, d

Which of the following form events lets a program validate the entries on the form and refuse to close if they are incorrect?
a. Closing
b. FormClosing
c. FormClosed
d. FormValidating

b

Which of the following statements about the Debug and Trace classes are true?
a. Debug methods are ignored if the DEBUG preprocessor symbol is not defined.
b. Trace methods are ignored if the DEBUG preprocessor symbol is not defined.
c. Trace methods are ignored if the TRACE preprocessor symbol is not defined.
d. Trace methods are ignored if Debug methods are ignored.

a, c

Which of the following statements about Debug and Trace listeners is true?
a. The default listener sends output to the Console window.
b. You can remove the default listener.
c. You can make a listener to save Debug or Trace output in a file.
d. You can make a listener to save Debug or Trace output in an event log.
e. You can make as many listeners as you like.

a, b, c, d, e

Which of the following statements about system event logs is true?
a. You can use the Event Viewer to view event logs.
b. A program can write entries only in an event log that it created.
c. Event logs keep track of the number of times something happened or the average number of events per hour.
d. You use the EventLog class’s WriteEvent method to save a message into an event log.

a, d

When Visual Studio’s profiler uses the CPU sampling method, how does it measure an application’s performance?
a. It periodically interrupts the program, determines its location, and stores the location to see where the program spends the most time.
b. It adds statements to the code to store the program’s location to see where the program spends the most time.
c. It records the program’s location at statements that you add to the code to see where the program spends the most time.
d. After each CPU cycle it records the program’s location to see where the program spends the most time.

a

When Visual Studio’s profiler uses the instrumentation method, how does it measure an application’s performance?
a. It periodically interrupts the program, determines its location, and stores the location to see where the program spends the most time.
b. It adds statements to the code to store the program’s location to see where the program spends the most time.
c. It records the program’s location at statements that you add to the code to see where the program spends the most time.
d. After each CPU cycle it records the program’s location to see where the program spends the most time.

b

For which of the following would performance counters be helpful?
a. Identify the methods where the program spends the most time.
b. Track the average number of jobs processed per second over time.
c. Identify jobs that take longer than average to process.
d. Record the total number of jobs processed.

b, d

You are a developer at company xyx. You have been asked to implement a method to safely save and restore data on the local machine. What kind of algorithm best fits the requirements?
a. Symmetric algorithm
b. Asymmetric algorithm
c. Hashing algorithm
d. X509Certificate
e. None of the above

a

You are a developer at the company xyx. You have been asked to implement a method to safely send data to another machine. What kind of algorithm best fits the requirements?
a. Symmetric algorithm
b. Asymmetric algorithm
c. Hashing algorithm
d. X509Certificate
e. None of the above

b

You are a developer at the company xyx. You have been asked to implement a method to handle password encryption without offering the possibility to restore the password. What kind of algorithm best fits the requirements?
a. Symmetric algorithm
b. Asymmetric algorithm
c. Hashing algorithm
d. X509Certificate
e. None of the above

c

Which of the following code snippets will you use to calculate the secure hash of a byte array called userData? If you already have created an algorithm object called sha.
a. userData.GetHashCode(sha);
b. sha.ComputeHash(userData);
c. sha.GetHash(userData);
d. sha.EncryptHash(userData);

b

Which of the following code snippets will you use to encrypt an array called userData that can be decrypted by anyone logged in on the current machine, and without using any entropy?
a. ProtectedData.Protect(userData, null,
DataProtectionScope.CurrentUser);
b. ProtectedData.Protect(userData, null,
DataProtectionScope.LocalMachine);
c. ProtectedData.Encrypt(userData, null,
DataProtectionScope.CurrentUser);
d. ProtectedData.Unprotect(userData, null,
DataProtectionScope.LocalMachine);

b

Which of the following code will you use to encrypt an array called encryptedData that can be encrypted by the current user, and without using any entropy?
a. ProtectedData.Unprotect(encryptedData,
null, DataProtectionScope.CurrentUser);
b. ProtectedData.Protect(encryptedData, null,
DataProtectionScope.LocalMachine);
c. ProtectedData.Decrypt(encryptedData, null,
DataProtectionScope.CurrentUser);
d. ProtectedData.Unprotect(encryptedData,
null, DataProtectionScope.LocalMachine);

a

What describes a strong name assembly?
a. Name
b. Version
c. Public key token
d. Culture
e. Processor Architecture
f. All the above

f

How can you deploy a strong named assembly?
a. By running gacutil.exe
b. By creating an installer
c. By running asm.exe
d. By copying the file to the Bin folder of the application
e. By running regsvcs.exe

a, b, d

How can you deploy a private assembly?
a. By running gacutil.exe
b. By adding a reference to the assembly in Visual Studio
c. By copying the file in the Bin folder of the application
d. By copying the file in C:\Windows folder

b, c

What is a strong name assembly?
a. An assembly with the name marked as bold
b. An assembly with a major and minor version specified
c. An assembly with a full version specified
d. An assembly with the culture info specified
e. A signed assembly

e