Final Flashcards
(81 cards)
C++ not only supports OOP but also supports other programming styles. T or F
T
In C++ the variables Alpha, ALPHA and AlphA are the same identifier. T or F
F
In C++ the compiler will infer the type intended for a variable from the context in which the variable occurs. T or F
F
A C++ variable declaration includes a name and data type. T or F
T
A C++ declaration is a definition that also allocates storage for an identifier’s value (or function’s body etc.). T or F
T
C++ uses only / / for comments. T or F
F
Code, within the same block, after a return or a call to the exit function, will not be executed. T or F
T
It is legal to replace the prototype double totalCost(int numberParam, double priceParam); with the more terse, alternate form double totalCost(int, double); T or F
T
Extensive use of global variables is a satisfactory replacement for the difficulties of parameter passing with functions. T or F
F
A variable declared outside any function is said to be a local variable. T or F
F
Consider two blocks, one within another. If an identifier is declared as a variable in the inmost of these two blocks, one can access this variable from the outer block. T or F
F
Given the declaration
int x = 0;
The following expression causes a divide by zero error:
(x == 0) || (2/x < 1); T or F
F
In a while loop, the boolean expression is executed before each execution of the loop body. T or F
T
A break statement is used in loops only. T or F
F
When a loop is nested inside another loop, a break terminates the outermost loop of the nested loop structure. T or F
F
Curly braces are required around a single statement contained in a control structure. T or F
F
The range of values for an unsigned int variable is from about -4 billion to +4 billion. T or F
F
In C++, which of the following is a legal identifier?
a) 9xyz
b) @Xyz
c) X+yz
d) xy_z
e) a and d
D
Pick the word that is not a C++ keyword out of the following list.
a) while
b) boolean
c) double
d) if
e) none of the above
B
Which of the following types is not built into the C++ language:
a) bool
b) real
c) short
d) long
e) double
B
An l-value is
a) an expression that can be only be placed on the left of any operator such as +, * , /, etc.
b) assigned a value
c) can never have a value fetched from it
d) is designed for use by a left-handed person
B
The value of the expression 20.0 * (9/5) + 32.0 is
a) 68.0
b) 52.0
c) incorrect expression so there is no value
d) 32.0
e) incorrect expression , the / should be %
B
A call to a C++ function is
a) The name of the function followed by empty parentheses.
b) The name of the function followed by any number of arguments, regardless of the
number of parameters in the definition.
c) The name of the function followed by a number of arguments not greater than the number
of parameters in the definition.
d) The name of the function only.
e) none of the above
C
A void function
a) performs some action and returns a value
b) performs some action but does not return a value
c) is a statement
d) call is written much like a call to a value returning function but is terminated with a
semicolon.
e) may return a value but is not required to have one.
B