QUESTIONS AND CORRECT ANSWERS
Which of the following is a valid C++ array definition? - CORRECT ANSWER int array[10];
A two dimensional array can have elements of ______ data type(s). - CORRECT ANSWER one
An array of string objects that will hold 5 names would be declared using which statement? -
CORRECT ANSWER string names [5];
What will the following code display?
Int numbers [] = (99, 87, 66, 55,101] ;
For (int I =1 1; i+4; i++)
Cout << numbers[i] << endl; - CORRECT ANSWER 87,66,55
When you work with a dereferenced pointers, you are actually working with: - CORRECT
ANSWER the actual value of the variable whose address is stored in the pointer variable.
What will the following code do?
Const int SIZE =5;
Doublex [SIZE];
For (int i=2; I <=SIZE; i++)
[X[i] = 0.0;] - CORRECT ANSWER An error will occur when the code runs.
Which of the following statements deletes memory that has been dynamically allocated for an array? -
CORRECT ANSWER delete [] array;
A pointer variable is designed to store: - CORRECT ANSWER Memory address
What will the following code output?
Int number = 22;
, Int * var = &number;
Cout << var << endl; - CORRECT ANSWER The address of the number variable
This is the escape sequence representing the null terminator? - CORRECT ANSWER \0
This function converts a c-string to an integer and returns the integer value. - CORRECT
ANSWER atoi
To determine whether a character entered is a letter of the alphabet, use this function. - CORRECT
ANSWER isalpha
To use the strien function in a program, you must also write #include: - CORRECT
ANSWER <string>
Which of the following is an example of a C++ primitive data type? - CORRECT
ANSWER All of these
You may use a pointer to a structure as a: - CORRECT ANSWER All of these
This is like a structure, except all members occupy the same memory area. - CORRECT
ANSWER union
Before a structure can be used, it must be: - CORRECT ANSWER declared
A function ____ return a structure - CORRECT ANSWER may
A structure ___ contain members of the same data type - CORRECT ANSWER can
A good reason to pass a structure as a constant reference is - CORRECT ANSWER To prevent
changes to the structure members
Look at the following declaration: