Name: 
 

adv09 review



True/False
Indicate whether the sentence or statement is true or false.
 

 1. 

C++ source code can be created using any text editor program.
 

 2. 

Comment statements are frequently used to provide special instructions to the compiler.
 

 3. 

All C++ programs consist of a single function, called main().
 

 4. 

C++ comment statements are frequently used to explain how a portion of a program works to make it easier for someone else to understand the program.
 

 5. 

In a C++ program, a variable named alpha can also be referenced as Alpha or ALPHA in the same program.
 

 6. 

The C++ integer data types are used for storing real numbers.
 

 7. 

The C++ division operator symbol is the backward slash (\).
 

 8. 

The C++ assignment operator functions the same way the equal sign functions in algebra.
 

 9. 

Parentheses can be used in an expression to change the order of operations.
 

 10. 

The destination of the input obtained using the cin statement must be a variable or variables.
 

 11. 

Although two characters appear when a special character is used, as in the \n special character, the compiler interprets it as a single character.
 

Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
 

 12. 

Every C++ program must have which of the following?
a.
compiler directives
c.
a main() function
b.
comment statements
d.
all of the above
 

 13. 

What characters are used in C++ source code to indicate the beginning and end of a block of code?
a.
parentheses ( )
c.
curly braces { }
b.
angle brackets < >
d.
square brackets [ ]
 

 14. 

Which of the following rules is true when it comes to assigning a name to a variable?
a.
variable names can contain spaces
b.
a variable name can start with a number
c.
a variable name can start with an underscore
d.
all of the above
 

 15. 

What name is used to describe a group of characters used together in a program to form a word or a sentence?
a.
block
c.
string
b.
set
d.
phrase
 

 16. 

Very large, and very small numbers, possibly containing fractional values can be stored in which of the following data types?
a.
int
c.
long
b.
double
d.
all of the above
 

 17. 

What keyword is used to define a constant value in a program?
a.
constant
c.
con
b.
cons
d.
const
 

 18. 

Which of the following symbols represents the C++ assignment operator?
a.
=
c.
->
b.
==
d.
<-
 

 19. 

Which C++ operator is used to determine the integer remainder value of a division operation?
a.
modulus
c.
left
b.
remainder
d.
balance
 

 20. 

While most arithmetic operators are always used with two operands, which operator below can also be used with a single operand?
a.
*
c.
^
b.
%
d.
-
 

 21. 

For the expression: x = 13 % 5; What would be the result stored in x
a.
2
c.
65
b.
3
d.
9,826,809
 

 22. 

Which statement below could be used in a C++ program to display a message and the result of a calculation to the user without requiring a variable to store the result?
a.
cout << "Result = x/y" << endl;
c.
cout << "Result = " << x/y << endl;
b.
cout << "Result = " x/y << endl;
d.
cout << "result = x/y endl; <<
 

 23. 

What will occur to the value in the variable count when the instruction count++; is executed?
a.
the value will be increased by one
c.
the value will have its sign changed
b.
the value will be doubled
d.
the value will be raised to a power of 2
 

 24. 

Which of the following items has the highest order of operations?
a.
multiplication
c.
addition
b.
division
d.
negation
 

 25. 

What is the name of the method in the oostring class that returns the current length of the string object?
a.
length
c.
len
b.
size
d.
strlen
 

 26. 

What character below is used to indicate to the C++ compiler that a special character is being used?
a.
\
c.
@
b.
/
d.
#
 

 27. 

Which of the following statements can be used as an alternative to the \n character?
a.
newl
c.
brkln
b.
nxtln
d.
endl
 



 
Check Your Work     Start Over