BTE320 Chapter 2

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

____________________ functions are those that have already been written and are provided as part of the system.

Predefined predefined Standard standard

____________________ is the process of planning and creating a program.

Programming programming

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

token

____________________ 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 comments

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

b. Prompt lines

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

a. 13

____________________ rules determine the meaning of instructions.

Semantic semantic

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

variable

Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____. a. alpha = 5 b. alpha = 10 c. alpha = 50 d. alpha = 50.0

c. alpha = 50

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

c. alpha = beta; beta = beta + 1;

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

a. 9

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

a. True

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

a. True

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

a. Insertion Point 1

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

a. True

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

a. True

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

a. True

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

a. beta = beta + 1; alpha = beta;

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

a. char

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

b. 'A'

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

b. 2

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

b. 3

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

b. 46259

A comma is also called a statement terminator. a. True b. False

b. False

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

b. False

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

b. False

In C++, reserved words are the same as predefined identifiers. a. True b. False

b. False

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

b. False

Which of the following is the newline character? a. \r b. \n c. \l d. \b

b. \n

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

b. four

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

b. int a,b,c;

In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >> two; executes, ____. a. one = 10.5, two = 10.5 b. one = 10.5, two = 30.6 c. one = 30.6, two = 30.6 d. one = 11, two = 31

b. one = 10.5, two = 30.6

Which of the following is a legal identifier? a. program! b. program_1 c. 1program d. program 1

b. program_1

The length of the string "computer science" is ____. a. 14 b. 15 c. 16 d. 18

c. 16

The value of the expression 17 % 7 is ____. a. 1 b. 2 c. 3 d. 4

c. 3

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

c. Sunny Day

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

c. beta = beta - 1; alpha = beta;

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

c. double

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

c. syntax

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

d. alpha = beta; beta = beta - 1;

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

d. sum = 15

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

subprogram


संबंधित स्टडी सेट्स

Chapter 3 - External Analysis: Industry Structure

View Set

Physics Chapter 3 Force and Motion & Chapter 4 Work and Energy

View Set

Chapter exam 1 & 2 life policies & provision

View Set

AP Computer Science: Worksheet Overviews

View Set

Chapter 23: Conditions Occurring After Birth

View Set

Chapter 7: Voting, Elections, and Political Participation

View Set

Disorders of Special Sensory Function-Chapter 38

View Set

Practice Ch. 5 Integumentary System

View Set