COP2000 Midterm Indian River State College

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

These are operators that add and subtract one from their operands. Answers: A. binary and unary B. conditional and relational C. ++ and -- D. None of these E. plus and minus

C. ++ and --

What will the value of result be after the following statement executes? result = 6 - 3 * 2 + 7 - 10 / 2 ; Answers: A. 6 B. 8 C. 2 D. 1.5

C. 2

In the following C++ statement, what will be executed first according to the order of precedence? result = 6 - 3 * 2 + 7 - 10 / 2 ; Answers: A. 2 + 7 B. 10 / 2 C. 3 * 2 D. 7 - 10 E. 6 - 3

C. 3 * 2

Of the following, which is a valid C++ identifier? Answers: A. ___department B. June1997 C. All of these are valid identifiers. D. _employee_number E. myExtraLongVariableName

C. All of these are valid identifiers.

What will the following code display? cout << "Four" << "score" << endl; cout << "and" << "seven" << endl; cout << "years" << "ago" << endl; Answers: A. Four score and seven years ago B. Fourscoreandsevenyearsago C. Fourscore andseven yearsago D. Four score and seven years ag

C. Fourscore andseven yearsago

Even when there is no power to the computer, data can be held in: Answers: A. The Output Device B. None of these C. Secondary storage D. The Input Device E. The Algorithm

C. Secondary storage

A file _________ is a small holding section of memory that file-bound information is first written to. Answers: A. segment B. number C. buffer D. name E. None of these

C. buffer

This statement may be used to stop a loop's current iteration and begin the next one. Answers: A. terminate B. break C. continue D. re-iterate E. None of these

C. continue

Which statement allows you to properly check the char variable code to determine whether it is equal to a "C" and then output "This is a check" and then advance to a new line? Answers: A. if (code == C) cout << "This is a check" << endl; B. if code is equal to C cout << "This is a check\n"; C. if (code == 'C') cout << "This is a check\n"; D. if (code = "C") cout << "This is a check" << endl;

C. if (code == 'C') cout << "This is a check\n";

The do-while loop is considered a(n) _________ loop. Answers: A. limited B. None of these C. post-test D. infinite E. pre-test

C. post-test

When this operator is used with string operands it concatenates them, or joins them together. Answers: A. + B. % C. None of these D. * E. &

A. +

What will be the value of result after the following code has been executed? int a = 60; int b = 15; int result = 10; if (a = b) result *= 2; Answers: A. 20 B. 10 C. 120 D. This code will not compile

A. 20

In memory, C++ automatically places a ___________ at the end of string literals. Answers: A. Null terminator B. Quotation marks C. None of these D. Semicolon E. Newline escape sequence

A. Null terminator

A(n) ____________ is a set of instructions that the computer follows to solve a problem. Answers: A. Program B. Compiler C. Operator D. Linker E. None of these

A. Program

The _________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed. Answers: A. cin object B. None of these C. cout object D. Preprocessor E. Output stream

A. cin object

Which of the following defines a double-precision floating point variable named payCheck? Answers: A. double payCheck; B. Double payCheck; C. payCheck double; D. float payCheck;

A. double payCheck;

What will be the output of the following code segment after the user enters 0 at the keyboard? int x = -1; cout << "Enter a 0 or a 1 from the keyboard: "; cin >> x; if (x) cout << "true" << endl; else cout << "false" << endl; Answers: A. false B. x C. Nothing will be displayed D. true

A. false

This is a variable, usually a boolean or an integer, that signals when a condition exists. Answers: A. flag B. None of these C. arithmetic operator D. relational operator E. float

A. flag

In any program that uses the cin object, you must include the ___________. Answers: A. iostream header file B. linker C. None of these D. compiler E. >> and << operators

A. iostream header file

What will the following code display? int number = 6; cout << ++number << endl; Answers: A. 0 B. 7 C. 5 D. 6

B. 7

This is used to mark the end of a complete C++ programming statement. Answers: A. Pound Sign B. Semicolon C. None of these D. Data type E. Void

B. Semicolon

This is a set of rules that must be followed when constructing a program. Answers: A. Operators B. Syntax C. Portability D. Punctuation E. Key words

B. Syntax

During which stage does the central processing unit retrieve from main memory the next instruction in the sequence of program instructions? Answers: A. execute B. fetch C. decode D. portability stage

B. fetch

Which statement will read an entire line of input into the following string object? string address; Answers: A. cin address; B. getline(cin, address); C. cin << address; D. cin.get(address); E. None of these

B. getline(cin, address);

The float data type is considered _____ precision, and the double data type is considered _______ precision. Answers: A. short, long B. single, double C. integer, double D. None of these E. float, double

B. single, double

What is the output of the following statement? cout << 4 * (15 / (1 + 3)) << endl; Answers: A. None of these B. 15 C. 63 D. 12 E. 72

D. 12

For every opening brace in a C++ program, there must be a: Answers: A. Function B. Variable C. None of these D. Closing brace E. String literal

D. Closing brace

What will the following segment of code output if 11 is entered at the keyboard? int number; cin >> number; if (number > 0) cout << "C++"; else cout << "Soccer"; cout << " is "; cout << "fun" << endl; Answers: A. C++ B. C++fun C. Soccerfun D. Soccer is fun E. C++ is fun

D. Soccer is fun

The name for a memory location that may hold data is: Answers: A. Key Word B. Syntax C. Operator D. Variable E. None of these

D. Variable

Programmer-defined names of memory locations that may hold data are: Answers: A. Operators B. Syntax C. Operands D. Variables E. None of these.

D. Variables

Given that x = 2, y = 1, and z = 0, what will the following cout statement display? cout << "answer = " << (x || !y && z) << endl; Answers: A. None of these B. answer = 2 C. answer = 0 D. answer = 1

D. answer = 1

The total number of digits that appear before and after the decimal point is sometimes referred to as: Answers: A. floating points B. significant digits C. precision D. b and c E. None of these

D. b and c

Relational operators allow you to ____________ numbers. Answers: A. average B. multiply C. add D. compare E. None of these

D. compare

When a variable is assigned a number that is too large for its data type, it: Answers: A. reverses polarity B. underflows C. None of these D. overflows E. exceeds expectations

D. overflows

Which one of the following would be an illegal variable name? Answers: A. _employee_num B. June1997 C. dayOfWeek D. itemsorderedforthemonth E. 3dGraph

E. 3dGraph

The statements written by the programmer are called: Answers: A. Runtime libraries B. Syntax C. None of these D. Object code E. Source code

E. Source code

In C++ the = operator indicates Answers: A. subtraction B. negation C. equality D. None of these E. assignment

E. assignment

If you want a user to enter exactly 20 values, which loop would be the best to use? Answers: A. do-while B. None of these C. infinite D. while E. for

E. for

Something within a while loop must eventually cause the condition to become false, or a(n) __________ results. Answers: A. unexpected exit B. None of these C. compiler error D. null value E. infinite loop

E. infinite loop

In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision. Answers: True False

False

The preprocessor executes after the compiler. Answers: True False

False

True/False: A while loop is somewhat limited, because the counter can only be incremented by one each time through the loop. Answers: True False

False

True/False: The scope of a variable declared in a for loop's initialization expression always extends beyond the body of the loop. Answers: True False

False

True/False: You may nest while and do-while loops, but you may not nest for loops. Answers: True False

False

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

False

A CPU really only understands instructions that are written in machine language. Answers: True False

True

Software engineering is a field that encompasses designing, writing, testing, debugging, documenting, modifying, and maintaining computer programs. Answers: True False

True

When typing in your source code into the computer, you must be very careful since most of your C++ instructions, header files, and variable names are case sensitive. Answers: True False

True

You should be careful when using the equality operator to compare floating point values because of potential round-off errors. Answers: True False

True

The default section is required in a switch statement. Answers: True False

false


Ensembles d'études connexes

APES Unit 5 Progress Check MCQ Review

View Set

apush unit 6 new south to industrial revolution

View Set

Final Exam Multiple Choice (test bank)

View Set

Study guide CT (IMAGE PRODUCTION)

View Set

5 characteristics of a free market system

View Set

Pathophysiology Exam 2 Test Bank

View Set