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

studied byStudied by 29 people
5.0(1)
Get a hint
Hint

A C++ program is a collection of ________.

1 / 59

60 Terms

1

A C++ program is a collection of ________.

functions

New cards
2

Every C++ program has a function called ____.

main

New cards
3

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

//

New cards
4

Multi-line comments are enclosed between __ and __.

/,/

New cards
5

True or False:

The compiler ignores comments.

true

New cards
6

________ words cannot be used as identifiers in a program.

reserved

New cards
7

True or False:

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

true

New cards
8

In C++, ___________ are names of things.

identifiers

New cards
9

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

identifier

New cards
10

_________ include blanks, tabs, and newline characters.

Whitespaces

New cards
11

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

data type

New cards
12

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

simple, structured, pointers

New cards
13

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

integral, floating-point, and enumeration.

New cards
14

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

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

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

bool

New cards
17

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

EBCDIC

New cards
18

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

collating sequence

New cards
19

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

float, double, long double

New cards
20

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

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

True or False:

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

true

New cards
23

The modulus operator, %, takes only _______ operands.

integer

New cards
24

True or False:

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

true

New cards
25

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

True or False:

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

true

New cards
27

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

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

cast

New cards
29

A ______ is a sequence of zero or more characters.

string

New cards
30

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

strings

New cards
31

True or False:

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

true

New cards
32

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

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

length

New cards
34

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

named constant

New cards
35

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

const

New cards
36

True or False:

A named constant must be initialized when it is declared.

true

New cards
37

True or False:

All variables must be declared before they can be used.

true

New cards
38

True or False:

C++ does not automatically initialize variables.

true

New cards
39

True or False:

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

true

New cards
40

True or False:

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

true

New cards
41

True or False:

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

true

New cards
42

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

stream extraction operator

New cards
43

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

input

New cards
44

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

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

stream insertion operator

New cards
46

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

cout

New cards
47

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

endl

New cards
48

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

The character _ is called the escape character.

\

New cards
50

The sequence __ is called the newline escape sequence.

\n

New cards
51

All preprocessor commands start with the symbol _.

#

New cards
52

#True or False

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

true

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

iostream

New cards
54

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

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

semicolon, ;

New cards
56

A C++ system has three components:

environment, language, and the standard libraries.

New cards
57

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

functions

New cards
58

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

.cpp

New cards
59

True or False:

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

true

New cards
60

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

+= -= *= /= %=

New cards

Explore top notes

note Note
studied byStudied by 279 people
... ago
5.0(1)
note Note
studied byStudied by 72 people
... ago
4.0(1)
note Note
studied byStudied by 66 people
... ago
5.0(4)
note Note
studied byStudied by 38 people
... ago
5.0(2)
note Note
studied byStudied by 21 people
... ago
5.0(1)
note Note
studied byStudied by 40096 people
... ago
4.8(312)

Explore top flashcards

flashcards Flashcard (25)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (23)
studied byStudied by 5 people
... ago
4.0(1)
flashcards Flashcard (58)
studied byStudied by 13 people
... ago
5.0(2)
flashcards Flashcard (26)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (25)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (28)
studied byStudied by 2 people
... ago
4.0(4)
flashcards Flashcard (33)
studied byStudied by 80 people
... ago
5.0(3)
flashcards Flashcard (79)
studied byStudied by 12 people
... ago
5.0(1)
robot