The following are examples of the types of questions that may appear on the final exam. The posted quiz questions are also another good place to find example questions.
What is wrong with the following definition for a C-style symbolic constant called PI?
#define PI = 3.24159
Which of the following is a condition that will test if the value in the integer variable num is even?
Which of the following (a-c) is a control structure?
How many times will the following while loop print "hello"?
int i = 1; while( i <= 10 ) cout << "hello"
A function prototype does not have to __________.
What will be displayed by the following code?
int main() { int num = 3; fn(num); cout << num; return 0; } void fn( int n ) { n++; }
What is the subscript of the last element in the array Table if it is defined as follows?
float Table[30];
Which of the following statements (a-d) about Table is true?
float Table[] = { 0.9, 0.8, 0.7, 0.6 };
Which of the following "chunks" of C++ code will print the contents of an array called ar that has been defined to hold 25 integer values and has been initialized with 25 integer values?
int i;
cout << ar[];
for( i = 0; i == 25; i++ ) cout << ar[i] << " ";
for( i = 0; i < 25; i++ ) cout << ar[i] << " ";
for( i = 0; i < 25; i++ ); cout << ar[i] << " ";
The following is a valid array definition.
int ar[];
What will be displayed by the following code?
int main() { int num[5] = { 2, 4, 6, 8, 10 }; int i; fn(num); for( i = 0; i < 5; i++ ) cout << num[i] << ' '; return 0; } int fn( int n[] ) { n[3] = n[3] + 1; }
Which of the following statements (a-d) are true if the following lines of code are executed?
int G = 17; int &H = G;
Which of the following is the correct definition for a variable called dblRef that can hold a reference to the double variable dblNum?
The null terminator is __________.
Which of the following string functions will ALWAYS produce a valid string after execution?
If a string will need room for 25 characters, how should it be defined so that it will be a valid string?
Which of the following statements (a-d) about classes is true?
The :: operator is used to associate a method with a specific class.
An instance of a class is known as a/an __________.
The class X contains two data members: an integer called xVal and a float called xPerc. Which of the following is not a valid prototype for the class definition for X?