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

studied byStudied by 14 people
5.0(1)
get a hint
hint

A C++ program is a collection of ________.

1 / 59

Studying Progress

0%
New cards
60
Still learning
0
Almost done
0
Mastered
0
60 Terms
1
New cards

A C++ program is a collection of ________.

functions

New cards
2
New cards

Every C++ program has a function called ____.

main

New cards
3
New cards

A single-line comment starts with the pair of symbols __ anywhere in the line.

//

New cards
4
New cards

Multi-line comments are enclosed between __ and __.

/,/

New cards
5
New cards

True or False:

The compiler ignores comments.

true

New cards
6
New cards

________ words cannot be used as identifiers in a program.

reserved

New cards
7
New cards

True or False:

All reserved words in C++ consist of lowercase letters.

true

New cards
8
New cards

In C++, ___________ are names of things.

identifiers

New cards
9
New cards

A C++ __________ consists of letters, digits, and underscores and must begin with a letter or an underscore.

identifier

New cards
10
New cards

_________ include blanks, tabs, and newline characters.

Whitespaces

New cards
11
New cards

A ____ ____ is a set of values together with a set of allowed operations.

data type

New cards
12
New cards

C++ data types fall into the following three categories: _, _, and ___.

simple, structured, pointers

New cards
13
New cards

There are three categories of simple data: _, _-_, and _______.

integral, floating-point, and enumeration.

New cards
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

New cards
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

New cards
16
New cards

The data type ____ has only two values: true and false

bool

New cards
17
New cards

The most common character sets are ASCII, which has 128 values, and ______ which has 256 values.

EBCDIC

New cards
18
New cards

The ________ _______ of a character is its preset number in the character data set.

collating sequence

New cards
19
New cards

C++ provides three data types to manipulate decimal numbers: , _, and ___ ___.

float, double, long double

New cards
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

New cards
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

New cards
22
New cards

True or False:

The arithmetic operators in C++ are addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).

true

New cards
23
New cards

The modulus operator, %, takes only _______ operands.

integer

New cards
24
New cards

True or False:

Arithmetic expressions are evaluated using the precedence rules and the associativity of the arithmetic operators.

true

New cards
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

New cards
26
New cards

True or False:

A mixed expression is an expression that consists of both integers and decimal numbers.

true

New cards
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

New cards
28
New cards

You can use the ____ operator to explicitly convert values from one data type to another.

cast

New cards
29
New cards

A ______ is a sequence of zero or more characters.

string

New cards
30
New cards

_______ in C++ are enclosed in double quotation marks.

strings

New cards
31
New cards

True or False:

A string containing no characters is called a null or empty string.

true

New cards
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

New cards
33
New cards

The ______ of a string is the number of characters in it.

length

New cards
34
New cards

During program execution, the contents of a ____ _______ cannot be changed.

named constant

New cards
35
New cards

A named constant is declared by using the reserved word _____.

const

New cards
36
New cards

True or False:

A named constant must be initialized when it is declared.

true

New cards
37
New cards

True or False:

All variables must be declared before they can be used.

true

New cards
38
New cards

True or False:

C++ does not automatically initialize variables.

true

New cards
39
New cards

True or False:

Every variable has a name, a value, a data type, and a size.

true

New cards
40
New cards

True or False:

When a new value is assigned to a variable, the old value is lost.

true

New cards
41
New cards

True or False:

Only an assignment statement or an input (read) statement can change the value of a variable.

true

New cards
42
New cards

In C++, >> is called the ____________________.

stream extraction operator

New cards
43
New cards

____ from the standard input device is accomplished by using cin and the stream extraction operator >>.

input

New cards
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

New cards
45
New cards

In C++, << is called the ____________________.

stream insertion operator

New cards
46
New cards

Output of the program to the standard output device is accomplished by using ___ and the stream insertion operator <<.

cout

New cards
47
New cards

The manipulator ____ positions the insertion point at the beginning of the next line on an output device.

endl

New cards
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

New cards
49
New cards

The character _ is called the escape character.

\

New cards
50
New cards

The sequence __ is called the newline escape sequence.

\n

New cards
51
New cards

All preprocessor commands start with the symbol _.

#

New cards
52
New cards

#True or False

The preprocessor commands are processed by the preprocessor before the program goes through the compiler.

true

New cards
53
New cards
The preprocessor command #include instructs the preprocessor to include the header file _______ in the program.

iostream

New cards
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

New cards
55
New cards

All C++ statements end with a _________. In C++, this symbol is called the statement terminator.

semicolon, ;

New cards
56
New cards

A C++ system has three components:

environment, language, and the standard libraries.

New cards
57
New cards

Standard libraries are not part of the C++ language. They contain _________ to perform operations, such as mathematical operations.

functions

New cards
58
New cards

A file containing a C++ program usually ends with the extension .___.

.cpp

New cards
59
New cards

True or False:

Prompt lines are executable statements that tell the user what to do.

true

New cards
60
New cards

Corresponding to the five arithmetic operators +, -, *, /, and %. C++ provides five compound operators: __, __, __, __, and __, respectively.

+= -= *= /= %=

New cards

Explore top notes

note Note
studied byStudied by 37 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 22 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 42 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 45 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 21 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 5808 people
Updated ... ago
4.9 Stars(19)

Explore top flashcards

flashcards Flashcard82 terms
studied byStudied by 67 people
Updated ... ago
5.0 Stars(3)
flashcards Flashcard53 terms
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard123 terms
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard35 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard30 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard37 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard104 terms
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard35 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)