View Assessment Result: Multiple Choice Quiz 1



Your performance was as follows:

1.
What is the type name used to represent single characters in C++?

(a) character
(b) Character
(c) Char
(d) char

Correct answer is (d)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (d) No Feedback



2.

One reason for using an assert statement such as

      assert( 0 <= i && i < 10 );

within code is to



(a) provide a comment for the user
(b) send a warning message but continue execution when the condition is violated
(c) terminate execution and send an error message whenever the condition is violated
(d) instruct the compiler to set i to any value in the indicated range

Correct answer is (c)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (c) No Feedback



3.
Each of the following is a basic C++ type EXCEPT

(a) byte
(b) unsigned int
(c) bool
(d) char

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (a) No Feedback



4.
In C++, evaluation of the expression left && right is accurately described by which of the following? (Assume that left && right is a syntactically correct expression.)

(a) The expression right will always be evaluated.
(b) The expression right will be evaluated if and only if the expression left evaluates to true.
(c) The expression right will be evaluated before the expression left is evaluated.
(d) The expression right will be evaluated if and only if the expression left evaluates to false.

Correct answer is (b)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (b) No Feedback



5.
How does C++ handle memory allocation?

(a) Allocation and deallocation is the responsibility of the programmer.
(b) Allocation and deallocation is completely shielded from the programmer.
(c) C++ always uses a garbage collector.
(d) C++ has a garbage collector that can be used or turned off.

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (a) No Feedback



6.
Assume that Thing is a user-defined type. Which of the following print functions for Thing is the safest and most efficient?

(a) void print( Thing x );
(b) void print( Thing& x );
(c) void print( const Thing& x );
(d) void print( Thing* x );

Correct answer is (c)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (c) No Feedback



7.
The signature of a function is

(a) the name of the function and its parameter list
(b) the body of the function
(c) the name of the function
(d) the number of parameters

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (a) No Feedback



8.

Execution of the conditional statement

      if( x = expr ) ;

has what effect?



(a) The value of expr is assigned to x if and only if that value is true.
(b) The values of x and expr are evaluated and compared.
(c) A compile-time error is produced.
(d) The value of expr is assigned to x and then x is evaluated.

Correct answer is (d)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (d) No Feedback



9.
Which of the following expressions evaluates to true in C++ if and only if the index variable i is in bounds for an array of size 10?

(a) 0 <= i && i < 10
(b) 0 < 10
(c) 0 <= i && i <= 10
(d) 0 <= i < 10

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (a) No Feedback



10.
Which company was responsible for the development of C++?

(a) AT&T
(b) IBM
(c) SUN
(d) Microsoft

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
   See section 1.1.1 of the course notes.
   (a) No Feedback



Go to top of assessment.

Total score: 100.00