midterm 1 mine

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The 'cin' statement continues reading input after encountering a newline or whitespace character. true or false

False

The = sign compares two values. true or false

False, the equality operator, ==, compares two values. The = sign assigns a value to an identifier and its data type. Reply Reply to Comment

A variable can be output before it has been defined. true or false

False

An if-else statement outputs multiple groups of expressions to be true, and false at once?

False

Of the following, which is a valid C++ identifier? a) All of these are valid identifiers. b) ___department c) myExtraLongVariableName d) _employee_number e) June1997

a) All of these are valid identifiers.

What is the value of x after the following code executes? int x; x= 3 / static_cast<int>(4.5+6.4); a) 0.3 b) 0 c) 0.275229 d) 3.3 e) None of these

b) 0

What is the value of result after the following statement executes? result = (3 * 5) % 4 + 24 / (15 - (7 - 4)); a) -6.4 b) 5 c) 1.6 d) 2.25 e) none of these

b) 5

Comments have no value and they are not important. a) Ture b) False

b) False

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

c) 13

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

c) >>, <<

In memory, C++ automatically places a ________ at the end of string literals a) Semicolon b) Quotation marks c) Null terminator d) None of these e) Newline escape sequence

c) Null terminator

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();

c) cin.get();

Which data type typically requires only one byte of storage? a)double b)int c)char d)float c)short

c)char

Block comments make it easier to write long explanations because you do not have to mark every line with a comment symbol. true or false

True

getline() doesn't skip leading whites pace, it gets all remaining text on the current input line, up to the new line character. true or false

True

If we cannot enter any information after using the getline code, how to solve the syntax error?

We should add cin.ignore(); in front of the information in order to ignore the return or new line.

What will the following code display? cout << "Four\n" <<score\n"; cout << "and" << "\nseven"; cout << "\nyears" << ago" << endl; a) Four score and seven years ago b) Four score and seven years ago c) Four score and seven years ago d) Fourscore and seven years ago

a) Four score and seven years ago

Before a variable in C++ is used it must be defined. a) True b) False

a) True

The only difference between the get function and the >> operator is that get reads the first character typed, even if it is a space, tab, or the [Enter] key. a) True B) False

a) True

The preprocessor reads a program before it is compiled and only executes those lines beginning with # symbol. a) True b) False

a) True

When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point. a) True b) Flase

a) True

Which statement is equivalent to the following?number += 1; a) number = number + 1; b) number = 1; c) number + 1; d) number =+ 1; e) None of these

a) number = number + 1;

Given a list of syntax errors from a compiler, a programmer should focus attention on which error(s), before recompiling? a) The last error only b)All the errors c)The middle error only d) The first error only

d) The first error only

Every complete C++ program must have a ________. a) symbolic constant b) preprocessor directive c) comment d) function named main e) cout statement

d) function named main

Which of the following statements will read an entire line of input into the string object, address? a) cin << address; b) cin address; c) cin.get(address); d) getline(cin, address); e) cin.get(length >> width >> height);

d) getline(cin, address);

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) c)whole(x)

d) round(x)

In programming terms, a group of characters inside a set of quotation marks is called a(n): a) Operation b) Variable c) None of these d) Statement e) String literal

e) String literal


Kaugnay na mga set ng pag-aaral

Health, Illness, and Disparities

View Set

Chapter 5: Judges and Kings Await a Messiah (Schott)

View Set

Mountains, Mountain Ranges, and Volcanos

View Set

Chapter 56: Management of Patients with Dermatologic Disorders and Wounds

View Set

Strategy Final Chapter 9 Cooperative Strategy

View Set

prepU ch 4 Common Reproductive Issues

View Set

NSG 330 Ch 54- Management Kidney Disorders

View Set