chapter 2 quiz

Ace your homework & exams now with Quizwiz!

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

true

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

true

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

3

____ is a valid int value. -32.00 462.59 46259 46,259

46259

Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____. sum = 15 sum = 10 sum = 0 sum = 5

sum=15

Choose the output of the following C++ statement:cout << "Sunny " << '\n' << "Day " << endl; Sunny \nDay endl Sunny \nDay Sunny \n Day Sunny Day

sunny day

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

syntax

The smallest individual unit of a program written in any language is called a(n) ____________________.

token

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

true

Suppose that sum is an int variable. The statement sum += 7; is equivalent to the statement sum = sum + 7; True False

true

A(n) ____________________ is a memory location whose contents can be changed.

variable

In a C++ program, ____________________ are used to separate special symbols, reserved words, and identifiers.

white spaces

____ is a valid char value. "A" 'A' "-129" 129

'A'

Which of the following is a reserved word in C++? CHAR Char char character

char

____________________ can be used to identify the authors of the program, give the date when the program is written or modified, give a brief explanation of the program, and explain the meaning of key statements in a program.

comments

An example of a floating point data type is ____. double char int short

double

The ____________________ type is C++ 's method for allowing programmers to create their own simple data types.

enumeration

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

false

____ are executable statements that inform the user what to do. Named constants Prompt lines Variables Expressions

prompt lines

____________________ rules determine the meaning of instructions.

semantic

A(n) ____________________ is a sequence of zero or more characters.

string

A(n) ____________________ is a collection of statements, and when it is activated, or executed, it accomplishes something.

subprogram

The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____. 15 14.8 14 13

13

The length of the string "computer science" is ____. 15 14 16 18

16

Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____. 3 4 1 2

2

The value of the expression 17 % 7 is ____. 3 4 2 1

3

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

9

A comma is also called a statement terminator. True False

False

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

False

Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statement(s) ____. beta = beta + 1;alpha = beta; alpha = beta;beta = beta + 1; alpha = alpha + beta; alpha = 1 + beta;

alpha = beta;beta = beta + 1;

Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s) ____. alpha = 1 - beta; alpha = beta;beta = beta - 1; beta = beta - 1;alpha = beta; alpha = beta - 1;

alpha = beta;beta = beta - 1;

Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statement(s) ____. alpha = alpha + beta; beta = beta + 1;alpha = beta; alpha = beta + 1; alpha = beta;beta = beta + 1;

beta = beta + 1;alpha = beta;

Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s) ____. beta = beta - 1;alpha = beta; alpha = 1 - beta; alpha = beta;beta = beta - 1; alpha = beta - 1;

beta = beta - 1;alpha = beta;

Consider the following code.// Insertion Point 1using namespace std;const float PI = 3.14;int main(){//Insertion Point 2float r = 2.0;float area;area = PI * r * r;cout << "Area = " << area <<endl;return 0;}// Insertion Point 3In this code, where does the include statement belong? Insertion Point 1 Insertion Point 3 Insertion Point 2 Anywhere in the program

insertion point 1

The declaration int a, b, c; is equivalent to which of the following? int abc; int a,b,c; int a b c; inta , b, c;

int a,b,c;

The memory space for a(n) ____________________ data value is 64 bytes.

long long

The maximum number of significant digits is called the ____________________.

precision

____________________ is the process of planning and creating a program.

programming

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

false

The memory allocated for a float value is ____ bytes. two sixteen eight four

four

When a value of one data type is automatically changed to another data type, a(n) ____________________ type coercion is said to have occurred.

implicit


Related study sets

Ch. 25: Chinese and Korean Art after 1279

View Set

Econ 320 Lecture 08 Practice Problems

View Set

immunization self-studies modules

View Set

Unit 1: Foundations of government

View Set

NCLEX Questions- Care of a Client with a tube

View Set

MISY 5325 Excel Midterm Ultimate Review

View Set