Programming C++  «Prev 

Basic C++ Programming - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 
1. In C++, the token // is used for:
  A. integer division
  B. concatenation
  C. comments
  D. exponentiation

2. The function strlen() computes:
  A. the number of non-whitespace characters in a string
  B. the length of a string, not including the null terminator
  C. the number of alphabetical characters in a string
  D. the length of a string, including the null terminator

3. In C++, cout is found in which library file?
  A. ctype.h
  B. stdlib.h
  C. math.h
  D. iostream.h

4. One difference between C++ and C is that C++:
  A. has long double
  B. is block structured
  C. has declarations that can go after executable code
  D. has no do-while statement

5. Assume that before the following cast, i is type int. What will i be after the cast is performed?

y = static_cast<float>(i);

  A. float
  B. char
  C. int
  D. double

6. The standard identifier cin is used for:
  A. a compiler flag
  B. standard output
  C. standard input
  D. the integer -1

7. In enum names {Harold, Phillip, Ira, Morris} the enumerator Morris is the integer value constant:
  A. 4
  B. 3
  C. 5
  D. system dependent

8. The keyword endl:
  A. defines a symbolic constant
  B. specifies that a function is to be compiled, if possible, as inline code
  C. provides assertion testing
  D. flushes the output stream and adds a new line

Correct answers:

Your Score: 0