Computer Science and C++ Quiz Answers, Page 4
Question #31
Will a C compiler always compile C++ code?
Yes.
No.
Only optimized compilers will compile C++ code.
Question #32
Which of the following is not a valid keyword:
public
protected
guarded
Question #33
What is the correct syntax for inheritance?
class aclass : public superclass
class aclass inherit superclass
class aclass <-superclass
Question #34
What does the following code snippet do:
for(;;)
;
The snippet is illegal
It loops forever
It is ignored by compiler, but it is not illegal
Question #35
Of the numbers 12, 23, 9, and 28, which one would be at the top of a properly implemented maxheap?
28
9
Any of them could be
Question #36
What does the line containing "break;" do in the following code?
void afunction()
{
if(1)
{
break;
a_function();
cout<<"Err";
}
}
Breaks out of the if statement
Exits the function
Nothing (Compiler error)
Question #37
To what value are pointers initialized?
NULL
Newly allocated memory
No action is taken by the compiler to initialize pointers.
Question #38
What is the last index number in an array of 100 chars?
100
99
101
Question #39
Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array?
Quicksort
Linear Search
Bubble Sort
Question #40
Which of the following data structures uses the least memory?
struct astruct
{
int x;
float y;
int v;
};
union aunion
{
int x;
float v;
};
char array[10];
Next Answers