Name:     ID: 
 
Email: 

C# Programming Final Exam

True/False
Indicate whether the statement is true or false.
 

 1. 

The body of a method can include statements that declare other methods.
 

 2. 

Use a type prefix, such as C for class name. For example, a student class should be named CStudent.
 

 3. 

ToString( ), Equals( ), GetType( ), and GetHashCode( ) are all methods of the object class.
 

 4. 

A standard convention used by C# programmers is to use Pascal case style for class, data member identifiers, and method identifiers.
 

 5. 

When you define a class method, you define its characteristics or fields in terms of the data.
 

 6. 

The return type for constructors is always the type of the class.
 

 7. 

Constants are normally named using all lowercase characters, separating second and subsequent words with the underscore character.
 

 8. 

An appropriate identifier used to store the total transaction amount is total$Amount.
 

 9. 

Procedural programming is also called structured programming.
 

 10. 

In order to indicate a value is constant and cannot be changed, the keyword constant is added.
 

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 11. 

double answer = Math.Pow(3, 2);
The result of the call to Math.Pow( ) in the above statement is to store ____ in answer:
a.
9
c.
6
b.
3,2
d.
an error message
 

 12. 

WriteLine(“Final Grade = {0:N2}”, CalculateGrade(90, 75, 83));
In the statement above, CalculateGrade(90, 75, 83) is ____.
a.
a method call
c.
an identifier of the class
b.
a method declaration
d.
a parameter for the WriteLin() method
 

 13. 

Local variables _____.
a.
are defined inside Main() and other methods
c.
are defined in class
b.
must be defined as private
d.
determine the data characteristics for the class
 

 14. 

Accessors are also referred to as ____.
a.
mutators
c.
properties
b.
getters
d.
Classes
 

 15. 

The ____ specifies what kind of information is returned when the body of the method is finished executing.
a.
access modifiers
c.
static modifier
b.
parameters
d.
returnType
 

 16. 

A property resembles a(n) ____, but is more closely aligned to a(n) ____.
a.
data field, method
c.
object, mutator
b.
method, data field
d.
mutator, accessor
 

 17. 

WriteLine(“Value = {0:N0}”, 12345.9032);
What will be displayed from the above line?
a.
Value = 12,346
c.
Value = 12,354
b.
Value =  12356
d.
Value = 12,346.0
 

 18. 

Which of the following would display "Good day!" on the screen?
a.
WriteLine.Console("Good day!");
c.
WriteLine.Console{"Good day!"};
b.
Console.WriteLine["Good day!"];
d.
Console.WriteLine("Good day!");
 

 19. 

Which method of the Console class allows multiple characters to be input via the keyboard?
a.
Write()
c.
Input()
b.
Read()
d.
ReadLine()
 

 20. 

The set of rules that a language such as C# has to follow are called ____ rules.
a.
syntax
c.
compiler
b.
semantic
d.
language
 

 21. 

If you expect to receive an “A” in this course, which of the following declarations would be most appropriate for storing the letter grade?
a.
char letterGrade;
c.
string grade;
b.
int letterGrade;
d.
double letterGrade;
 

 22. 

The compiler checks for ____.
a.
semantic violations
c.
debugger options
b.
files that are too large
d.
synatax rule violations
 

 23. 

In order to format the first argument in the WriteLine method so that it prints the value 5343.67 as $5,343.67 with a comma and a dollar symbol, you would insert the following format string as the argument to the WriteLine( ) ____.
a.
“{0:$,2}”
c.
“{0:C}”
b.
“{C:0}”
d.
“{0:F,2,$}”
 

 24. 

A(n) ____ version of software has not been fully tested and may still contain bugs or errors.
a.
alpha
c.
bug
b.
maintenance
d.
beta
 

 25. 

The value stored in answer after the following expression is evaluated is
                                             int v1 = 10, v2 = 5, ans =3;
                                             ans += --v1 * v2++;
a.
39
c.
57
b.
48
d.
none of the above
 

 26. 

WriteLine( ) differs from Write( ) in that ____.
a.
WriteLine( ) does not automatically advance to the next line
c.
WriteLine( ) was added in later releases of C#
b.
smaller items are printed using Write( )
d.
WriteLine( ) advances to the next line after it finishes displaying output
 

 27. 

The decimal equivalent of 00011111 is ____.
a.
5
c.
31
b.
10
d.
32
 

 28. 

Another way to write the following expression is ____.
                                             ans *= v1 - 1;
a.
ans = v1 * ans - 1;
c.
ans = ans * v1--;
b.
ans = v1 * (ans - 1);
d.
ans = ans * --v1;
 

 29. 

Which character is called the escape character in C#?
a.
*
c.
\
b.
Esc
d.
 

 30. 

An IDE enables you to ____.
a.
type your program statements into an editor
c.
compile an application
b.
debug an application
d.
all of the options
 



 
         Start Over