Coms215 Final Review

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

ch1 = 'A', ch2 = ' ', alpha = 18

Suppose that ch1 and ch2 are char variables, and alpha is an int variable. The input is: ​ A 18 ​ What are the values after the following statement executes? ​ cin.get(ch1); cin.get(ch2); cin >> alpha;

False

The device that stores information permanently (unless the device becomes unusable or you change the information by rewriting it) is called primary storage.

Input

The devices that feed data and programs into computers are called ____ devices.

10

The expression static_cast<int>(9.9) evaluates to ____.

less than or equal to

What does <= mean?

True

Information stored in main memory must be transferred to some other device for permanent storage.

random access memory

Main memory is called ____.

True

Main memory is directly connected to the CPU.

mainframe, midsize, and micro

Several categories of computers exist, such as ____.

True

Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.

True

Suppose a = 5. After the execution of the statement ++a; the value of a is 6.

x = 28, y = 32, z = 12.0

Suppose that x and y are int variables, and z is a double variable. The input is: ​ 28 32.6 12 ​ Choose the values of x, y, and z after the following statement executes: ​ cin >> x >> y >> z;

alpha = 17, ch = 'A'

Suppose that alpha is an int variable and ch is a char variable. The input is: ​ 17 A ​ What are the values after the following statements execute? ​ cin >> alpha; cin >> ch; ​

False

The statement in the body of a while loop acts as a decision maker.

True

A compound statement functions as if it was a single statement.

False

A comma is also called a statement terminator.

True

A control structure alters the normal sequential flow of execution in a program.

False

A mixed arithmetic expression contains all operands of the same type.

double

An example of a floating point data type is ____.

False

An operator that has only one operand is called a unique operator.

True

Assume all variables are properly declared. The output of the following C++ code is 2 3 4 5. n = 1; while (n < 5) { n++; cout << n << " "; }

False

Assume that all variables are properly declared. The following for loop executes 20 times. for (i = 0; i <= 20; i++) cout << i;

False

C++ programs have always been portable from one compiler to another.

True

Entering a char value into an int variable causes serious errors, called input failure.

False

If input failure occurs in a C++ program, the program terminates immediately and displays an error message.

False

In C++, reserved words are the same as predefined identifiers.

True

In C++, the operators != and == have the same order of precedence.

selection

In a ____ control structure, the computer executes particular statements depending on some condition(s).

True

In a counter-controlled while loop, the loop control variable must be initialized before the loop.

False

In a sentinel-controlled while loop, the body of the loop continues to execute until the EOF symbol is read.

False

In an output statement, each occurrence of endl advances the cursor to the end of the current line on an output device.

True

In the case of the sentinel-controlled while loop, the first item is read before the while loop is entered.

False

In the statement cin >> x;, x can be a variable or an expression.

False

It is a good idea to redefine cin and cout in your programs.

memory cells

Main memory is an ordered sequence of items, called ____.

'C'

Suppose that ch1, ch2, and ch3 are variables of the type char. The input is: ​ A B C ​ Choose the value of ch3 after the following statement executes: ​ cin >> ch1 >> ch2 >> ch3;

cin >> x >> y;

Suppose that x and y are int variables. Which of the following is a valid input statement?

x = 10, y = 20.7

Suppose that x is an int variable and y is a double variable. The input is: ​ 10 20.7 ​ Choose the values after the following statement executes: cin >> x >> y;.

ch = '2', x = 76

Suppose that x is an int variable, ch is a char variable, and the input is: 276. Choose the values after the following statement executes: cin >> ch >> x;

x = 15, ch = 'A', y = 73.2

Suppose that x is an int variable, y is a double variable, and ch is a char variable. The input is: ​ 15A 73.2 ​ Choose the values after the following statement executes: ​ cin >> x >> ch >> y; ​

x = 15, y = 76.3, z = 14

Suppose that x is an int variable, y is a double variable, and z is an int variable. The input is: ​ 15 76.3 14 ​ Choose the values after the following statement executes: ​ cin >> x >> y >> z; ​

(x > 0) || ( x <= 0)

Suppose that x is an int variable. Which of the following expressions always evaluates to true?

True

Suppose we declare a variable sum as an int. The statement "sum += 7;" is equivalent to the statement "sum = sum + 7;".

true

Suppose x is 5 and y is 7. Choose the value of the following expression: (x != 7) && (x <= y)

operating system

The ____ handles the overall activity of the computer and provides services.

CPU

The ____ is the brain of the computer and the single most expensive piece of hardware in your personal computer.

syntax

The ____ rules of a programming language tell you which statements are legal, or accepted, by the programming language.

input, output, storage

The basic commands that a computer performs are ____, and performance of arithmetic and logical operations.

True

The basic commands that a computer performs are input (get data), output (display result), storage, and performance of arithmetic and logical operations.

False

The command that does the linking on Visual C++ Express (2013 or 2016) and Visual Studio 2015 is Make or Remake.

True

The control statements in the for loop include the initial statement, loop condition, and update statement.

True

The control variable in a flag-controlled while loop is a bool variable.

False

The devices that feed data and programs into computers are called output devices.

output

The devices that the computer uses to display results are called ____ devices.

False

The escape sequence \r moves the insertion point to the beginning of the next line.

False

The expression (x >= 0 && x <= 100) evaluates to false if either x < 0 or x >= 100.

False

The extraction operator >> skips only all leading blanks when searching for the next data in the input stream.

False

The following statements will result in input failure if the input values are not on a separate line. (Assume that x and y are int variables.) cin >> x; cin >> y;

False

The following while loop terminates when j > 20. j = 0; while (j < 20) j++;

True

The maximum number of significant digits in float values is up to 6 or 7.

True

The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.

True

The number of iterations of a counter-controlled loop is known in advance.

False

The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable

False

The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable.

3

The value of the expression 33/10, assuming both values are integral data types, is ____.

True

To develop a program to solve a problem, you start by analyzing the problem.

True

When reading data into a char variable, after skipping any leading whitespace characters, the extraction operator >> finds and stores only the next character; reading stops after a single character.

False

When the computer is turned off, everything in secondary memory is lost.

False

When you compile your program, the compiler identifies the logic errors and suggests how to correct them.

10 < x && x < 20

Which of the following expressions correctly determines that x is greater than 10 and less than 20?

program_1

Which of the following is a legal identifier?

==

Which of the following is a relational operator?

char

Which of the following is a reserved word in C++?

!=

Which of the following is the "not equal to" relational operator?

!

Which of the following operators has the highest precedence?

=

Which of the following operators has the lowest precedence?

int, bool

You can use either a(n) ____ or a ____ to store the value of a logical expression.

True

You can use the function getline to read a string containing blanks.

'A'

____ is a valid char value.

46259

____ is a valid int value.

Application

____ programs perform a specific task.

Digital signals

____ represent information with a sequence of 0s and 1s.

True

If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.

False

If the expression in an assert statement evaluates to true, the program terminates.

True

The maximum number of significant digits in values of the double type is 15.

four

The memory allocated for a float value is ____ bytes.

3

The value of the expression 17 % 7 is ____.

True

In C++, && has a higher precedence than ||.

This statement results in input failure

Suppose that x and y are int variables, ch is a char variable, and the input is: 4 2 A 12 Choose the values of x, y, and ch after the following statement executes: cin >> x >> ch >> y;


Ensembles d'études connexes

ch 6 - interest rates and bond valuation

View Set

HW30: Homework - Ch. 30: Unemployment and Labor Force Participation

View Set

Chapter S6: Statistical Process Control

View Set

Chapter 4: introduction to hardware and software

View Set

Anthropogenic Impacts Chapter 7 & 8 Review

View Set