Return to Topic Menu | Computer Science Main Page | MathBits.com  | Terms of Use | Resource CD
 

Multiple Choice C++ Quiz
 Unit 2 - Data Basics

 

Directions:  Choose the best answer.  Use the button at the bottom
to check your answers.


1.  When working with character arrays, always reserve enough array elements to hold the string AND its null-terminating character (\0).
     [a] True
     [b] False
 

2.  In C++, 14 % 4 =

     [a] 1
     [b] 2
     [c] 3
     [d] 4

3.  Variables that are declared, but not initialized, contain

     [a] blank spaces
     [b] zeros
     [c] "garbage" values
     [d] nothing - they are empty

4.  Array indexing always starts with the number

     [a] 0
     [b] 1
     [c] 2
     [d] \0

5.  A character variable may contain up to seven letters.

     [a] True
     [b] False

6.  All strings end with a null zero in memory.

     [a] True
     [b] False

7.  In C++. 5 / 2 =

     [a] 2
     [b] 2.5
     [c] 3
     [d] none of the above

8.  Variables with names that describe the data stored at that particular memory location are called

     [a] identifiers
     [b] constant variables
     [c] floating point variables
     [d] mnemonic variables

9.  The name of a variable is known as its

     [a] identifier
     [b] constant
     [c] data type
     [d] base

10.  The special class developed by the College Board to be used with strings is

     [a] apstrings.cpp
     [b] apstring.cpp
     [c] aparray.cpp
     [d] apletters.cpp

11.  In C++, the % refers to

     [a] percentages
     [b] modulus operator
     [c] division
     [d] data storage

12.  A variable is given a value through

     [a] osmosis
     [b] the cout statement
     [c] the <iomanip.h> header file
     [d] an assignment statement

13.  Variable names may begin with a number.

     [a] True
     [b] False

14.  When a data type must contain decimal numbers, assign the type

     [a] int
     [b] char
     [c] double
     [d] long int

15.  Mathematicians and computers interpret the equal sign (=) in the same way.

     [a] True
     [b] False

16.  setprecision requires the header file

     [a] stdlib.h
     [b] iomanip.h
     [c] console.h
     [d] conio.h

17.  The following statement is valid.    double price = 7,450.98;

     [a] True
     [b] False

18.  All variables must be declared before they can be used.

     [a] True
     [b] False

19.  Character literals always have a length of one.

     [a] True
     [b] False

20.  If   char catname[15];  , which of the following is valid?

     [a] catname[15] = "Millie";
     [b] catname = "Millie";
     [c] catname[ ] = "Millie";
     [d] none are valid

 

Return to Topic Menu | Computer Science Main Page | MathBits.com  | Terms of Use | Resource CD