Filters
Question type

Study Flashcards

A statement that starts with a hashtag (or pound) symbol (#) is called a


A) comment
B) function
C) preprocessor directive
D) header file
E) None of these

F) C) and D)
G) A) and E)

Correct Answer

verifed

verified

A(n) __________ represents a storage location in the computer's memory.


A) literal
B) variable
C) comment
D) integer
E) None of these

F) D) and E)
G) B) and D)

Correct Answer

verifed

verified

The float data type is considered ___________ precision and the double data type is considered __________ precision.


A) single, double
B) double, single
C) floating-point, double
D) floating-point, integer
E) None of these

F) A) and B)
G) A) and E)

Correct Answer

verifed

verified

In the following statement, the characters Hello! are a(n) cout << "Hello!";


A) variable
B) string literal
C) comment
D) object
E) None of these

F) All of the above
G) B) and D)

Correct Answer

verifed

verified

Which of the following defines a double-precision floating-point variable named payCheck?


A) float payCheck;
B) double payCheck;
C) payCheck double;
D) Double payCheck;

E) None of the above
F) All of the above

Correct Answer

verifed

verified

What is output of the following statement? cout << 4 * (15 / (1 + 3) ) << endl;


A) 15
B) 12
C) 63
D) 72
E) None of these

F) A) and D)
G) None of the above

Correct Answer

verifed

verified

Which of the following statements correctly defines a named constant named TAX_RATE that holds the value 0.075?


A) double TAX_RATE = 0.075;
B) const TAX_RATE;
Double TAX_RATE = 0.075;
C) const double TAX_RATE = 0.075;
D) double TAX_RATE;
Const TAX_RATE = 0.075;
E) const TAX_RATE = 0.075;

F) B) and E)
G) None of the above

Correct Answer

verifed

verified

A character literal is __________, whereas a string literal is __________


A) enclosed in quotation marks, enclosed in brackets
B) enclosed in brackets, enclosed in quotation marks
C) enclosed in double quotation marks, enclosed in single quotation marks
D) enclosed in single quotation marks, enclosed in double quotation marks
E) None of these

F) A) and E)
G) A) and C)

Correct Answer

verifed

verified

The __________ causes the content of another file to be inserted into a program.


A) cout object
B) double slash (//)
C) #include directive
D) semicolon (;)
E) None of these

F) A) and D)
G) A) and C)

Correct Answer

verifed

verified

Which of the following must be included in any program that uses the cout object?


A) opening and closing braces
B) the header file iostream
C) comments
D) a namespace
E) None of these

F) B) and D)
G) A) and D)

Correct Answer

verifed

verified

A variable definition tells the computer


A) the variable's name and its value
B) the variable's data type and its value
C) the variable's name and the type of data it will hold
D) whether the variable is an integer or a floating-point number
E) None of these

F) A) and E)
G) All of the above

Correct Answer

verifed

verified

What will the following code display? int x = 23, y = 34, z = 45; cout << x << y << z << endl;


A) 23 34 45
B) 23
34
45
C) xyz
D) 233445

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Data items whose values do not change while the program is running are


A) literals
B) variables
C) characters
D) integers
E) None of these

F) A) and D)
G) A) and C)

Correct Answer

verifed

verified

A named constant is like a variable, but it its content cannot be changed while the program is running.

A) True
B) False

Correct Answer

verifed

verified

Given the following program, which line(s) cause(s) output to be displayed on the screen? 1 // This program displays my gross wages. 2 // I worked 40 hours and I make $20.00 per hour. 3 #include <iostream> 4 using namespace std; 5 6 int main() 7 { 8 \quad int hours; 9 \quad double payRate, grossPay; 10 11 \quad hours = 40; 12 \quad payRate = 20.0; 13 \quad grossPay = hours * payRate; 14 \quad cout << "My gross pay is $" << grossPay << endl; 15 \quad return 0; 16 }


A) lines 13 and 14
B) lines 8 and 9
C) line 14
D) lines 14 and 15
E) line 15

F) C) and E)
G) A) and C)

Correct Answer

verifed

verified

What is the value of number after the following statements execute? Int number; Number = 18 % 4 + 2;


A) 3
B) 4
C) 6.5
D) 0
E) unknown

F) D) and E)
G) B) and C)

Correct Answer

verifed

verified

In a cout statement, which of the following will advance the output position to the beginning of the next line?


A) endl or \n
B) end1 or /n
C) \n or \t
D) \t or \b
E) \\ or \'

F) C) and D)
G) B) and C)

Correct Answer

verifed

verified

Programming style refers to the way a programmer uses elements such as identifiers, spaces, and blank lines.

A) True
B) False

Correct Answer

verifed

verified

Which data type typically requires only one byte of storage?


A) short
B) int
C) float
D) char
E) string

F) A) and E)
G) A) and D)

Correct Answer

verifed

verified

Select all that apply. Using C++11: Which of the following can be used to initialize an integer variable named dozen with the value of 12?


A) int dozen = 12;
B) int dozen(12) ;
C) int dozen = {12};
D) int dozen = (12) ;
E) int dozen {12};

F) A) and B)
G) B) and D)

Correct Answer

verifed

verified

Showing 41 - 60 of 62

Related Exams

Show Answer