View Assessment Result: Multiple Choice Quiz 1



Your performance was as follows:

1.
What is the type name used to represent extra precision real numbers in C++?

(a) real
(b) double
(c) float
(d) long float

Correct answer is (b)

Your score on this question is: 0.00

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



2.
Assuming that Thing is some user-defined type, which of the following functions uses the least useful parameter list?

(a) bool f( Thing& x ); save space and permit f() to easily mutate the object
(b) bool f( Thing x ); give f() its own copy of x to work with.
(c) bool f( const Thing& x ); save space and protect the integrity of the object
(d) bool f( const Thing x ); f() gets its own copy of x, but is unable to mutate it.

Correct answer is (d)

Your score on this question is: 0.00

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



3.
Which of the following derived types is significantly different with respect to the other three?

(a) structure
(b) function
(c) union
(d) array

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



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 be evaluated before the expression left is evaluated.
(b) The expression right will always be evaluated.
(c) The expression right will be evaluated if and only if the expression left evaluates to false.
(d) The expression right will be evaluated if and only if the expression left evaluates to true.

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



5.

Suppose inf is an available ifstream and c is an available character. Consider the following code fragment.

do
    c = inf.get();
while (!inf.eof() && isspace(c));

Which of the following accurately describes the effect of executing this fragment?



(a) The number of non-white-space characters is counted.
(b) Characters are read until a non-white-space character is read or until the end of the file is reached.
(c) Characters are read until a white space is read.
(d) Characters are read until the end of the file is reached.

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



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( const Thing& x );
(c) void print( Thing& x );
(d) void print( Thing x );

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



7.

Compilers follow the "maximal munch rule" (read as many characters as can possibly be assembled into a meaningful syntactic construct). Therefore, what happens with the following?

      int a = 5; int b = 10;
     cout << (a+++++b) << " ";
     cout << a << " " << b << endl;


(a) Prints 15 6 11
(b) Prints 15 7 10
(c) Does not compile.
(d) Prints 16 6 11

Correct answer is (c)

Your score on this question is: 0.00

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



8.
Which of the following statements uses the C++ pre-increment operator?

(a) x += y;
(b) x = ++y;
(c) x = y++;
(d) x = y+y;

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



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 <= i < 10
(c) 0 <= i && i <= 10
(d) 0 < 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) Microsoft
(b) AT&T
(c) IBM
(d) SUN

Correct answer is (b)

Your score on this question is: 0.00

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



Go to top of assessment.

Total score: 60.00