Deck 2: Introduction to C Plus Plus

Full screen (f)
exit full mode
Question
A C++ character literal is enclosed in ______ quotation marks, whereas a string literal is enclosed in ______ quotation marks.

A) double, single
B) triple, double
C) open, closed
D) single, double
E) no, some
Use Space or
up arrow
down arrow
to flip the card.
Question
Which of the following is/are valid C++ identifiers?

A) June-2010
B) June.2010
C) June_2010
D) 2010June
E) Both C and D.
Question
The following two C++ statements perform the same operation.
wages = regPay + overTime;
regPay + overTime = wages;
Question
The ________ is used to display information on the computer's screen.

A) < symbol
B) cin object
C) cout object
D) print object
E) output object
Question
A variable of the char data type can hold a set of characters like "January".
Question
#include is an example of a(n)

A) comment.
B) I/O statement.
C) preprocessor directive.
D) stream directive.
E) compiler option.
Question
If number is an int variable, both of the following statements will print out its value:
cout << number;
cout << "number";
Question
Which of the following definitions will allow the variable total to hold floating-point values?

A) float total;
B) double total;
C) auto total = 0.0;
D) All of the above
E) A and B, but not C
Question
What value will be assigned to the variable number by the following statement?
Int number = 7.8;

A) 7
B) 8
C) 7.8
D) None of the above.
E) It's unpredictable. That's the problem.
Question
The ________ directive causes the contents of another file to be inserted into a program.

A) #getfile
B) #library
C) #insert
D) #include
E) None of the above
Question
What value will be assigned to the variable number by the following statement?
Int number = 7.8;

A) 7
B) 8
C) 7.8
D) None of the above.
E) It's unpredictable. That's the problem.
Question
________ are data items whose values cannot change while the program is running.

A) Literals
B) Variables
C) Fixed data
D) Integers
E) None of the above
Question
The expression 5 % 2 evaluates to

A) 1
B) 2
C) 2.5
D) 5.2
E) 10
Question
The expression 5 / 2 evaluates to

A) 1
B) 2
C) 2.5
D) 5.2
E) 10
Question
Which of the following will cause the next output to begin on a new line?

A) cout << endl;
B) cout << "endl";
C) cout << "/n";
D) All of the above
E) A and C, but not B
Question
The bool data type

A) can be used to store a single character.
B) has only two values: True and false.
C) is used to store extra-large numbers.
D) is used to represent numbers in E notation.
E) does none of the above.
Question
C++ automatically places ________ at the end of a string literal.

A) a semicolon
B) quotation marks
C) the null terminator
D) a newline escape sequence
E) a blank
Question
C++ is a case-sensitive language.
Question
You must have a(n) ________ for every variable you include in a program.

A) purpose
B) definition
C) comment
D) numeric value
E) output statement
Question
In a C++ program, two slash marks ( // ) indicate the beginning of

A) a block of code.
B) a comment.
C) a variable definition.
D) a program.
E) none of the above.
Question
Which of the following keywords is/are the names of C++ data types?

A) short
B) long
C) double
D) bool
E) All of the above
Question
The expression 7 % 2 evaluates to

A) 1
B) 3
C) 3.5
D) 7.2
E) 14
Question
An operation that copies a value into a variable is called a(n) ________ operation.

A) assignment
B) equals
C) copy
D) declaration
E) cout
Question
A ________ variable can hold only one of two values: True or false.

A) binary
B) single precision
C) T/F
D) char
E) bool
Question
The following two statements both assign the value 5 to the variable dept.
5 = dept;
dept = 5;
Question
________ must be included in a program in order to use the cout object.

A) Opening and closing braces
B) The iostream header file
C) A cout declaration
D) Strings
E) None of the above
Question
What value will be assigned to the variable number by the following statement?
Int number = 3.75;

A) 3
B) 4
C) 3.75
D) None of the above.
E) It's unpredictable. That's the problem.
Question
A ________ is used to mark the end of a complete C++ programming statement.

A) comment
B) period
C) semicolon
D) closing brace
E) new line
Question
Which of the following is/are valid C++ identifiers?

A) department_9
B) aVeryLongVariableName
C) last-name
D) All of the above.
E) Both A and B, but not C.
Question
Which of the following definitions will allow the variable average to hold floating-point values?

A) float average;
B) double average;
C) auto average = 0.0;
D) All of the above
E) A and B, but not C
Question
What literal(s) appear in the following C++ statement?
Int number = 4 + 8;

A) number
B) 4
C) 8
D) 12
E) both B and C
Question
The following two statements could be used interchangeably in a C++ program.
// Program Payroll
/* Program Payroll */
Question
The following is a legal C++ statement to define and initialize a variable.
char firstName = "Jack";
Question
In programming terms, a group of characters inside a set of double quotation marks (" ") is called

A) a character literal.
B) a string literal.
C) a character set.
D) none of the above.
E) any of the above.
Question
The expression 7 / 2 evaluates to

A) 1
B) 3
C) 3.5
D) 7.2
E) 14
Question
A variable must be defined

A) in every program.
B) and initialized at the same time.
C) in order to perform output.
D) before it can be used.
E) in all of the above cases.
Question
If a variable is defined as
int sum;
it may be written in the program code as sum or Sum, but not SUM.
Question
The following statements both declare the variable num to be an integer.
int num;
INT num;
Question
Which of the following will cause the next output to begin on a new line?

A) cout << endl;
B) cout << "endl";
C) cout << "/n";
D) All of the above
E) A and C, but not B
Question
Every C++ program must have

A) comments.
B) variables.
C) literals.
D) a function called main..
E) all of the above.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 2: Introduction to C Plus Plus
1
A C++ character literal is enclosed in ______ quotation marks, whereas a string literal is enclosed in ______ quotation marks.

A) double, single
B) triple, double
C) open, closed
D) single, double
E) no, some
D
2
Which of the following is/are valid C++ identifiers?

A) June-2010
B) June.2010
C) June_2010
D) 2010June
E) Both C and D.
C
3
The following two C++ statements perform the same operation.
wages = regPay + overTime;
regPay + overTime = wages;
False
4
The ________ is used to display information on the computer's screen.

A) < symbol
B) cin object
C) cout object
D) print object
E) output object
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
A variable of the char data type can hold a set of characters like "January".
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
#include is an example of a(n)

A) comment.
B) I/O statement.
C) preprocessor directive.
D) stream directive.
E) compiler option.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
If number is an int variable, both of the following statements will print out its value:
cout << number;
cout << "number";
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
Which of the following definitions will allow the variable total to hold floating-point values?

A) float total;
B) double total;
C) auto total = 0.0;
D) All of the above
E) A and B, but not C
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
What value will be assigned to the variable number by the following statement?
Int number = 7.8;

A) 7
B) 8
C) 7.8
D) None of the above.
E) It's unpredictable. That's the problem.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
The ________ directive causes the contents of another file to be inserted into a program.

A) #getfile
B) #library
C) #insert
D) #include
E) None of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
What value will be assigned to the variable number by the following statement?
Int number = 7.8;

A) 7
B) 8
C) 7.8
D) None of the above.
E) It's unpredictable. That's the problem.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
________ are data items whose values cannot change while the program is running.

A) Literals
B) Variables
C) Fixed data
D) Integers
E) None of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
The expression 5 % 2 evaluates to

A) 1
B) 2
C) 2.5
D) 5.2
E) 10
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
The expression 5 / 2 evaluates to

A) 1
B) 2
C) 2.5
D) 5.2
E) 10
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following will cause the next output to begin on a new line?

A) cout << endl;
B) cout << "endl";
C) cout << "/n";
D) All of the above
E) A and C, but not B
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
The bool data type

A) can be used to store a single character.
B) has only two values: True and false.
C) is used to store extra-large numbers.
D) is used to represent numbers in E notation.
E) does none of the above.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
C++ automatically places ________ at the end of a string literal.

A) a semicolon
B) quotation marks
C) the null terminator
D) a newline escape sequence
E) a blank
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
C++ is a case-sensitive language.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
You must have a(n) ________ for every variable you include in a program.

A) purpose
B) definition
C) comment
D) numeric value
E) output statement
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
In a C++ program, two slash marks ( // ) indicate the beginning of

A) a block of code.
B) a comment.
C) a variable definition.
D) a program.
E) none of the above.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
Which of the following keywords is/are the names of C++ data types?

A) short
B) long
C) double
D) bool
E) All of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
The expression 7 % 2 evaluates to

A) 1
B) 3
C) 3.5
D) 7.2
E) 14
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
An operation that copies a value into a variable is called a(n) ________ operation.

A) assignment
B) equals
C) copy
D) declaration
E) cout
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
A ________ variable can hold only one of two values: True or false.

A) binary
B) single precision
C) T/F
D) char
E) bool
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
The following two statements both assign the value 5 to the variable dept.
5 = dept;
dept = 5;
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
________ must be included in a program in order to use the cout object.

A) Opening and closing braces
B) The iostream header file
C) A cout declaration
D) Strings
E) None of the above
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
What value will be assigned to the variable number by the following statement?
Int number = 3.75;

A) 3
B) 4
C) 3.75
D) None of the above.
E) It's unpredictable. That's the problem.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
A ________ is used to mark the end of a complete C++ programming statement.

A) comment
B) period
C) semicolon
D) closing brace
E) new line
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
Which of the following is/are valid C++ identifiers?

A) department_9
B) aVeryLongVariableName
C) last-name
D) All of the above.
E) Both A and B, but not C.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
Which of the following definitions will allow the variable average to hold floating-point values?

A) float average;
B) double average;
C) auto average = 0.0;
D) All of the above
E) A and B, but not C
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
What literal(s) appear in the following C++ statement?
Int number = 4 + 8;

A) number
B) 4
C) 8
D) 12
E) both B and C
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
The following two statements could be used interchangeably in a C++ program.
// Program Payroll
/* Program Payroll */
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
The following is a legal C++ statement to define and initialize a variable.
char firstName = "Jack";
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
In programming terms, a group of characters inside a set of double quotation marks (" ") is called

A) a character literal.
B) a string literal.
C) a character set.
D) none of the above.
E) any of the above.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
The expression 7 / 2 evaluates to

A) 1
B) 3
C) 3.5
D) 7.2
E) 14
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
A variable must be defined

A) in every program.
B) and initialized at the same time.
C) in order to perform output.
D) before it can be used.
E) in all of the above cases.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
If a variable is defined as
int sum;
it may be written in the program code as sum or Sum, but not SUM.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
The following statements both declare the variable num to be an integer.
int num;
INT num;
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following will cause the next output to begin on a new line?

A) cout << endl;
B) cout << "endl";
C) cout << "/n";
D) All of the above
E) A and C, but not B
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
Every C++ program must have

A) comments.
B) variables.
C) literals.
D) a function called main..
E) all of the above.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 40 flashcards in this deck.