Filters
Question type

Study Flashcards

A debugging process where you, the programmer, pretend you are a computer and step through each statement while recording the value of each variable at each step is known as


A) error checking
B) hand writing
C) hand tracing
D) error handling
E) None of these

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

Correct Answer

verifed

verified

Which of the following statements will pause the screen until the [Enter] key is pressed?


A) cin;
B) cin.getline() ;
C) cin.get() ;
D) cin.ignore() ;
E) cin.input() ;

F) A) and B)
G) A) and C)

Correct Answer

verifed

verified

What is the value of x after the following code executes? Int x = 0; Int y = 5; Int z = 4; X = x + y + z * 2;


A) 18
B) 0
C) 13
D) 26
E) unknown

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

Correct Answer

verifed

verified

When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive.

A) True
B) False

Correct Answer

verifed

verified

The __________ operator always follows the cin object, and the __________ operator follows the cout object.


A) binary, unary
B) conditional, binary
C) >>, <<
D) <<, >>
E) None of these

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

Correct Answer

verifed

verified

In the following statement, what will be executed first according to the order of precedence? Result = 6 - 3 * 2 + 7 - 10 / 2;


A) 6 - 3
B) 3 * 2
C) 2 + 7
D) 10 / 2
E) 7 - 10

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

Correct Answer

verifed

verified

__________ reads a line of input, including leading and embedded spaces, and stores it in a string object.


A) cin.get
B) getline
C) cin.getline
D) get
E) None of these

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

Correct Answer

verifed

verified

Which of the following functions will return the value of x, rounded to the nearest whole number?


A) abs(x)
B) fmod(x)
C) sqrt(x)
D) round(x)
E) whole(x)

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

Correct Answer

verifed

verified

This manipulator forces cout to print digits in fixed-point notation:


A) setprecision(2)
B) setw(2)
C) fixed
D) setfixed(2)
E) None of these

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

Correct Answer

verifed

verified

If you want to know the length of the string that is stored in a string object, you can call the object's size member function.

A) True
B) False

Correct Answer

verifed

verified

What will be displayed after the following statements execute? int num1 = 5; int num2 = 3; cout << "The result is " << (num1 * num2 + 10) << endl;


A) The result is 5 * 3 + 10
B) The result is (num1 * num2 + 10)
C) The result is 25
D) The result is 65
E) None of these

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

Correct Answer

verifed

verified

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 \quad const int MY_VAL = 77; 7 \quad MY_VAL = 99; 8 \quad cout << MY_VAL << endl; 9 \quad return 0; 10 }


A) line 6
B) line 7
C) line 8
D) line 9
E) there will be no compiler error

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

Correct Answer

verifed

verified

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


A) compiler
B) the header file iostream
C) linker
D) brackets
E) None of these

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

Correct Answer

verifed

verified

The following statement will output $5.00 to the screen: cout << setprecision(5) << dollars << endl;

A) True
B) False

Correct Answer

verifed

verified

The fixed manipulator causes a number to be displayed in scientific notation.

A) True
B) False

Correct Answer

verifed

verified

How many characters will the following statement read into the variable myString? Cin >> setw(10) >> myString;


A) 9
B) 10
C) 11
D) however many characters are in myString
E) None of these

F) A) and B)
G) A) and C)

Correct Answer

verifed

verified

Which of the following will allow the user to input the values 15 and 20 and have them stored in variables named base and height, respectively?


A) cin << base << height;
B) cin base, height;
C) cin >> base >> height;
D) cin base >> cin height;
E) None of these

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

Correct Answer

verifed

verified

When C++ is working with an operator, it strives to convert the operands to the same type.

A) True
B) False

Correct Answer

verifed

verified

To use the rand() function, you must include the __________ header file?


A) cstdlib
B) cstring
C) iostream
D) cmath
E) iomanip

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

Correct Answer

verifed

verified

The cin << statement will stop reading input when it encounters a newline character.

A) True
B) False

Correct Answer

verifed

verified

Showing 21 - 40 of 45

Related Exams

Show Answer