C++ Programming: Program design including data structures - Chapter 2

5.0(1)
studied byStudied by 36 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/59

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

60 Terms

1
New cards
A C++ program is a collection of \________.
functions
2
New cards
Every C++ program has a function called \____.
main
3
New cards
A single-line comment starts with the pair of symbols \__ anywhere in the line.
//
4
New cards
Multi-line comments are enclosed between \__ and __.
/*,*/
5
New cards
True or False:

The compiler ignores comments.
true
6
New cards
\________ words cannot be used as identifiers in a program.
reserved
7
New cards
True or False:

All reserved words in C++ consist of lowercase letters.
true
8
New cards
In C++, \___________ are names of things.
identifiers
9
New cards
A C++ \__________ consists of letters, digits, and underscores and must begin with a letter or an underscore.
identifier
10
New cards
\_________ include blanks, tabs, and newline characters.
Whitespaces
11
New cards
A \____ \____ is a set of values together with a set of allowed operations.
data type
12
New cards
C++ data types fall into the following three categories: \______, \__________, and \_______.
simple, structured, pointers
13
New cards
There are three categories of simple data: \________, \________-\_____, and \___________.
integral, floating-point, and enumeration.
14
New cards
Integral data types are classified into the following categories: c\___, s\____, i__, l\___, b\___, unsigned c\___, unsigned s\____, unsigned i__, unsigned l\___, l\___ l\___, and unsigned l\___ l\___.
char, short, int, long, bool, unsigned char, unsigned short, unsigned int, unsigned long, long long, unsigned long long
15
New cards
The values belonging to int data type are -2,147,483,648 or -2^31 to 2,147,483,647 or \____.
2^31
16
New cards
The data type \____ has only two values: true and false
bool
17
New cards
The most common character sets are ASCII, which has 128 values, and \______ which has 256 values.
EBCDIC
18
New cards
The ________ _______ of a character is its preset number in the character data set.
collating sequence
19
New cards
C++ provides three data types to manipulate decimal numbers: ___*, _*__*, and ___ _*___.
float, double, long double
20
New cards
The data type \_____ is used in C++ to represent any real number between -3.4 * 10^38 and 3.4 * 10^38
float
21
New cards
The data type \______ is used in C++ to represent any real number between -1.7 * 10^308 and 1.7 * 10^308. The memory allocated for a value of this data type is eight bytes.
double
22
New cards
True or False:

The arithmetic operators in C++ are addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).
true
23
New cards
The modulus operator, %, takes only \_______ operands.
integer
24
New cards
True or False:

Arithmetic expressions are evaluated using the precedence rules and the associativity of the arithmetic operators.
true
25
New cards
True or False:

All operands in an integral expression, or integer expression, are integers, and all operands in a floating-point expression are decimal numbers.
true
26
New cards
True or False:

A mixed expression is an expression that consists of both integers and decimal numbers.
true
27
New cards
True or False:

When evaluating an operator in an expression, an integer is converted to a floating-point number, with a decimal part of 0, only if the operator has mixed operands.
true
28
New cards
You can use the \____ operator to explicitly convert values from one data type to another.
cast
29
New cards
A \______ is a sequence of zero or more characters.
string
30
New cards
\_______ in C++ are enclosed in double quotation marks.
strings
31
New cards
True or False:

A string containing no characters is called a null or empty string.
true
32
New cards
Every character in a string has a relative position in the string. The position of the first character is \____, the position of the second character is 1, and so on.
zero, 0
33
New cards
The \______ of a string is the number of characters in it.
length
34
New cards
During program execution, the contents of a ____ _______ cannot be changed.
named constant
35
New cards
A named constant is declared by using the reserved word \_____.
const
36
New cards
True or False:

A named constant must be initialized when it is declared.
true
37
New cards
True or False:

All variables must be declared before they can be used.
true
38
New cards
True or False:

C++ does not automatically initialize variables.
true
39
New cards
True or False:

Every variable has a name, a value, a data type, and a size.
true
40
New cards
True or False:

When a new value is assigned to a variable, the old value is lost.
true
41
New cards
True or False:

Only an assignment statement or an input (read) statement can change the value of a variable.
true
42
New cards
In C++, >> is called the ____________________.
stream extraction operator
43
New cards
____ from the standard input device is accomplished by using cin and the stream extraction operator >>.
input
44
New cards
True or False:

When data is input in a program, the data items, such as numbers, are usually separated by blanks, lines, or tabs.
true
45
New cards
In C++, << is called the ____________________.
stream insertion operator
46
New cards
Output of the program to the standard output device is accomplished by using ___ and the stream insertion operator <
cout
47
New cards
The manipulator \____ positions the insertion point at the beginning of the next line on an output device.
endl
48
New cards
True or False

Outputting or accessing the value of a variable in an expression does not destroy or modify the contents of the variable.
true
49
New cards
The character _ is called the escape character.
\\
50
New cards
The sequence \__ is called the newline escape sequence.
\n
51
New cards
All preprocessor commands start with the symbol _.
\#
52
New cards
\#True or False

The preprocessor commands are processed by the preprocessor before the program goes through the compiler.
true
53
New cards
The preprocessor command #include instructs the preprocessor to include the header file _______ in the program.
iostream
54
New cards
True or False:

To use cin and cout, the program must include the header file iostream and either include the statement using namespace std; or refer to these identifiers as std::cin and std::cout.
true
55
New cards
All C++ statements end with a \_________. In C++, this symbol is called the statement terminator.
semicolon, ;
56
New cards
A C++ system has three components:
environment, language, and the standard libraries.
57
New cards
Standard libraries are not part of the C++ language. They contain \_________ to perform operations, such as mathematical operations.
functions
58
New cards
A file containing a C++ program usually ends with the extension .\___.
.cpp
59
New cards
True or False:

Prompt lines are executable statements that tell the user what to do.
true
60
New cards
Corresponding to the five arithmetic operators +, -, *, /, and %. C++ provides five compound operators: __, __, __, __, and __, respectively.
+\= -\= *\= /\= %\=