Appendix
Answers to Sample Test Questions
Chapter 1: Introducing the Programming in C# Certification
Chapter 1 has no chapter test questions.
Chapter 2: Basic Program Structure
1. You want to declare an integer variable called myVar and assign it the value 0. How can you accomplish this?
2. 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?
3. What kind of result is returned in the condition portion of an if statement?
4. What are the keywords supported in an if statement?
5. 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);
6. 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){}
7. What is the purpose of break; in a switch statement?
b. It causes the code to exit the switch statement.
8. What are the four basic repetition structures in C#?
c. for, foreach, while, do-while
9. How many times will this loop execute?
int value = 0;
do
{
Console.WriteLine (value);
} while value > 10;
Chapter 3: Working with the Type System
1. What is the maximum value you can store in an int data type?