C++ Programming: From Problem Analysis to Program Design, 8th Edition Test Bank
Preview Extract
Name:
Class:
Date:
Chapter 2
1. In C++, reserved words are the same as predefined identifiers.
a. True
b. False
ANSWER:
False
POINTS:
1
REFERENCES:
36
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
2. The maximum number of significant digits in values of the double type is 15.
a. True
b. False
ANSWER:
True
POINTS:
1
REFERENCES:
41
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
3. The maximum number of significant digits in float values is up to 6 or 7.
a. True
b. False
ANSWER:
True
POINTS:
1
REFERENCES:
42
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
4. An operator that has only one operand is called a unique operator.
a. True
b. False
ANSWER:
False
POINTS:
1
REFERENCES:
45
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 1
Name:
Class:
Date:
Chapter 2
5. If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
a. True
b. False
ANSWER:
True
POINTS:
1
REFERENCES:
46
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
6. A mixed arithmetic expression contains all operands of the same type.
a. True
b. False
ANSWER:
False
POINTS:
1
REFERENCES:
48
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
7. Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
a. True
b. False
ANSWER:
True
POINTS:
1
REFERENCES:
70
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 2
Name:
Class:
Date:
Chapter 2
8. The escape sequence r moves the insertion point to the beginning of the next line.
a. True
b. False
ANSWER:
False
POINTS:
1
REFERENCES:
7
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
9. A comma is also called a statement terminator.
a. True
b. False
ANSWER:
False
POINTS:
1
REFERENCES:
88
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
10. Suppose we declare a variable sum as an int. The statement “sum += 7;” is equivalent to the statement “sum =
sum + 7;”.
a. True
b. False
ANSWER:
True
POINTS:
1
REFERENCES:
93
QUESTION TYPE: True / False
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/16/2016 9:02 AM
Copyright Cengage Learning. Powered by Cognero.
Page 3
Name:
Class:
Date:
Chapter 2
11. The ____ rules of a programming language tell you which statements are legal, or accepted, by the programming
language.
a. semantic
b. logical
c. syntax
d. grammatical
ANSWER:
c
POINTS:
1
REFERENCES:
34
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/16/2016 9:03 AM
12. Which of the following is a reserved word in C++?
a. char
b. Char
CHAR
c.
d. character
ANSWER:
a
POINTS:
1
REFERENCES:
35
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
13. Which of the following is a legal identifier?
a. program!
b. program_1
c. 1program
d. program 1
ANSWER:
b
POINTS:
1
REFERENCES:
36
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 4
Name:
Class:
Date:
Chapter 2
14. ____ is a valid int value.
a. 46,259
b. 46259
c. 462.59
d. -32.00
ANSWER:
b
POINTS:
1
REFERENCES:
39
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
15. ____ is a valid char value.
a. “-129”
b. โAโ
c. “A”
d. 129
ANSWER:
b
POINTS:
1
REFERENCES:
40
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
16. An example of a floating point data type is ____.
a. int
b. char
c. double
d. short
ANSWER:
c
POINTS:
1
REFERENCES:
41
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
17. The memory allocated for a float value is ____ bytes.
a. two
b. four
c. eight
d. sixteen
ANSWER:
b
POINTS:
1
REFERENCES:
41
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 5
Name:
Class:
Date:
Chapter 2
18. The value of the expression 17 % 7 is ____.
a. 1
b. 2
c. 3
d. 4
ANSWER:
c
POINTS:
1
REFERENCES:
43
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
19. The value of the expression 33/10, assuming both values are integral data types, is ____.
a. 0.3
b. 3
c. 3.0
d. 3.3
ANSWER:
b
POINTS:
1
REFERENCES:
43-44
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
20. The expression static_cast(9.9) evaluates to ____.
a. 9
b. 10
c. 9.9
d. 9.0
ANSWER:
a
POINTS:
1
REFERENCES:
51
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 6
Name:
Class:
Date:
Chapter 2
21. The expression static_cast(6.9) + static_cast(7.9) evaluates to ____.
a. 13
b. 14
c. 14.8
d. 15
ANSWER:
a
POINTS:
1
REFERENCES:
51
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
22. The length of the string “computer science” is ____.
a. 14
b. 15
c. 16
d. 18
ANSWER:
c
POINTS:
1
REFERENCES:
53
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
23. In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement
cin >> one >> two; executes, ____.
a. one = 10.5, two = 10.5
b. one = 10.5, two = 30.6
c. one = 30.6, two = 30.6
d. one = 11, two = 31
ANSWER:
b
POINTS:
1
REFERENCES:
65
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 7
Name:
Class:
Date:
Chapter 2
24. Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of
count is ____.
a. 1
b. 2
c. 3
d. 4
ANSWER:
b
POINTS:
1
REFERENCES:
69-70
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
25. Suppose that alpha and beta are int variables. The statement alpha = –beta; is equivalent to the
statement(s) ____.
a. alpha = 1 – beta;
b. alpha = beta – 1;
c. beta = beta – 1;
alpha = beta;
d. alpha = beta;
beta = beta – 1;
ANSWER:
c
POINTS:
1
REFERENCES:
70-71
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
26. Suppose that alpha and beta are int variables. The statement alpha = beta–; is equivalent to the
statement(s) ____.
a. alpha = 1 – beta;
b. alpha = beta – 1;
c. beta = beta – 1;
alpha = beta;
d. alpha = beta;
beta = beta – 1;
ANSWER:
d
POINTS:
1
REFERENCES:
70-71
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 8
Name:
Class:
Date:
Chapter 2
27. Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the
statement(s) ____.
a. alpha = 1 + beta;
b. alpha = alpha + beta;
c. alpha = beta;
beta = beta + 1;
d. beta = beta + 1;
alpha = beta;
ANSWER:
c
POINTS:
1
REFERENCES:
70-71
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
28. Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the
statement(s) ____.
a. beta = beta + 1;
alpha = beta;
b. alpha = beta;
beta = beta + 1;
c. alpha = alpha + beta;
d. alpha = beta + 1;
ANSWER:
a
POINTS:
1
REFERENCES:
70-71
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 9
Name:
Class:
Date:
Chapter 2
29. Choose the output of the following C++ statement:
cout << "Sunny " << 'n' << "Day " << endl;
a. Sunny nDay
b. Sunny nDay endl
c. Sunny
Day
d. Sunny n
Day
ANSWER:
c
POINTS:
1
REFERENCES:
72
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
30. Which of the following is the newline character?
a. r
b. n
c. l
d. b
ANSWER:
b
POINTS:
1
REFERENCES:
72
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 10
Name:
Class:
Date:
Chapter 2
31. Consider the following code.
// Insertion Point 1
using namespace std;
const float PI = 3.14;
int main()
{
//Insertion Point 2
float r = 2.0;
float area;
area = PI * r * r;
cout << "Area = " << area <<endl;
return 0;
}
// Insertion Point 3
In this code, where does the include statement belong?
a. Insertion Point 1
b. Insertion Point 2
c. Insertion Point 3
d. Anywhere in the program
ANSWER:
a
POINTS:
1
REFERENCES:
82
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
32. ____ are executable statements that inform the user what to do.
a. Variables
b. Prompt lines
c. Named constants
d. Expressions
ANSWER:
b
POINTS:
1
REFERENCES:
89
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 11
Name:
Class:
Date:
Chapter 2
33. The declaration int a, b, c; is equivalent to which of the following?
a. inta , b, c;
b. int a,b,c;
c. int abc;
d. int a b c;
ANSWER:
b
POINTS:
1
REFERENCES:
90
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
34. Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha
*= beta; executes, ____.
a. alpha = 5
b. alpha = 10
c. alpha = 50
d. alpha = 50.0
ANSWER:
c
POINTS:
1
REFERENCES:
92
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
35. Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num
executes, ____.
a. sum = 0
b. sum = 5
c. sum = 10
d. sum = 15
ANSWER:
d
POINTS:
1
REFERENCES:
93
QUESTION TYPE: Multiple Choice
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 12
Name:
Class:
Date:
Chapter 2
36. ____________________ is the process of planning and creating a program.
ANSWER:
Programming
programming
POINTS:
1
REFERENCES:
28
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
37. A(n) ____________________ is a memory location whose contents can be changed.
ANSWER:
variable
POINTS:
1
REFERENCES:
33
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
38. A(n) ____________________ is a collection of statements, and when it is activated, or executed, it accomplishes
something.
ANSWER:
subprogram
sub program
sub-program
function
module
POINTS:
1
REFERENCES:
33
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
39. ____________________ functions are those that have already been written and are provided as part of the system.
ANSWER:
Predefined
predefined
Standard
standard
POINTS:
1
REFERENCES:
33-34
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 13
Name:
Class:
Date:
Chapter 2
40. ____________________ rules determine the meaning of instructions.
ANSWER:
Semantic
semantic
POINTS:
1
REFERENCES:
34
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
41. ____________________ can be used to identify the authors of the program, give the date when the program is written
or modified, give a brief explanation of the program, and explain the meaning of key statements in a program.
ANSWER:
Comments
comments
POINTS:
1
REFERENCES:
34
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
42. The smallest individual unit of a program written in any language is called a(n) ____________________.
ANSWER:
token
POINTS:
1
REFERENCES:
35
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
43. In a C++ program, ____________________ are used to separate special symbols, reserved words, and identifiers.
ANSWER:
whitespaces
whitespace
white spaces
white space
POINTS:
1
REFERENCES:
37
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 14
Name:
Class:
Date:
Chapter 2
44. The ____________________ type is C++ โs method for allowing programmers to create their own simple data types.
ANSWER:
enumeration
POINTS:
1
REFERENCES:
38
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
45. The memory space for a(n) ____________________ data value is 64 bytes.
ANSWER:
long long
POINTS:
1
REFERENCES:
39
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
46. The maximum number of significant digits is called the ____________________.
ANSWER:
precision
POINTS:
1
REFERENCES:
42
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
47. When a value of one data type is automatically changed to another data type, a(n) ____________________ type
coercion is said to have occurred.
ANSWER:
implicit
POINTS:
1
REFERENCES:
50
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 15
Name:
Class:
Date:
Chapter 2
48. A(n) ____________________ is a sequence of zero or more characters.
ANSWER:
string
POINTS:
1
REFERENCES:
53
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
49. In C++, you can use a(n) ____________________ to instruct a program to mark those memory locations in which data
is fixed throughout program execution.
ANSWER:
named constant
constant
POINTS:
1
REFERENCES:
54
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
50. A data type is called ____________________ if the variable or named constant of that type can store only one value at
a time.
ANSWER:
simple
POINTS:
1
REFERENCES:
57
QUESTION TYPE: Completion
HAS VARIABLES: False
DATE CREATED: 10/5/2016 1:36 PM
DATE MODIFIED: 10/5/2016 1:36 PM
Copyright Cengage Learning. Powered by Cognero.
Page 16
Document Preview (16 of 235 Pages)
User generated content is uploaded by users for the purposes of learning and should be used following SchloarOn's honor code & terms of service.
You are viewing preview pages of the document. Purchase to get full access instantly.
-37%
C++ Programming: From Problem Analysis to Program Design, 8th Edition Test Bank
$18.99 $29.99Save:$11.00(37%)
24/7 Live Chat
Instant Download
100% Confidential
Store
Isabella Jones
0 (0 Reviews)
Best Selling
The World Of Customer Service, 3rd Edition Test Bank
$18.99 $29.99Save:$11.00(37%)
Chemistry: Principles And Reactions, 7th Edition Test Bank
$18.99 $29.99Save:$11.00(37%)
Test Bank for Hospitality Facilities Management and Design, 4th Edition
$18.99 $29.99Save:$11.00(37%)
Solution Manual for Designing the User Interface: Strategies for Effective Human-Computer Interaction, 6th Edition
$18.99 $29.99Save:$11.00(37%)
2023-2024 ATI Pediatrics Proctored Exam with Answers (139 Solved Questions)
$18.99 $29.99Save:$11.00(37%)
Test Bank for Strategies For Reading Assessment And Instruction: Helping Every Child Succeed, 6th Edition
$18.99 $29.99Save:$11.00(37%)