Programming Final C++

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

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

CPU

Which of the following statements at Line 3 can be used to open the file progdata.dat and input data from this file into x and y at line 4?

inFile.open("progdata.dat");

A loop that continues to execute endlessly is called a(n) ______ loop

infinite

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

input, output, storage

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.

true

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

variable

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

sum = 15

A(n) ____________________ structure does not require the evaluation of a logical expression.

switch

The conditional operator ? : takes __ arguments. a. two b. three c. four d. five

three

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

true

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

true

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

true

Functions that do not have a return type are called ____ functions.

void

10 20.7 Choose the values after the following statement executes: cin >> x >> y;

x = 10, y = 20.7

15A 73.2 cin >> x >> ch >> y;

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

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

true

In C++, a function prototype is the function heading without the body of the function.

true

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

true

Main memory is directly connected to the CPU.

true

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

true

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

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

true

The data type of a variable in a return statement must match the function type.

true

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

true

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

true

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

true

Using functions greatly enhances a program's readability because it reduces the complexity of the function main.

true

What is the value of x after the following statements execute? int x; x=(5<=3 && 'A' <'F')? 3:4

4

____ 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 the key statements in a program.

Comments

Which of the following operators has the lowest precedence?

=

Which of the following is a relational operator

==

What are the equality operators?

==, !=

___ programs perform a specific task, such as word processing.

Application

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

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

___ languages include FORTRAN, COBOL, Pascal, C, C++, Java, and Python

High-level

A function prototypes is____.

a declaration, but not a definition

A program called a(n) ____ translates instructions written in high-level languages into machine code.

complier

In C++, you can use a(n) ___ to instruct a program to mark those memory locations in which data is fixed throughout program execution.

constant

In a switch statement, if the value of the expression does not match any of the case values, the statements following the ___ label execute.

default

Which of the following loops is guaranteed to execute at least once

do...while loop

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

false

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

false

If the formal parameter list of a function is empty, the parentheses after the function name are not needed.

false

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

false

Suppose found = true and num = 6. The value of the expression ... ( !found ) || ( num > 6 ) is___.

false

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

false

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

false

The following return statement returns the value 10.return 10, 16;

false

The following statements will result in input failure if the input values are not on a separate line. cin>> x; cin>> y;

false

The function main is always compiled first, regardless of where in the program the function main is placed

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 value of the expression 6<5 || 'g' > 'a' && 7<4 is ___.

false

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

false

A variable listed in a header is known as a(n) ____ parameter.

formal

The memory allocated for a float value is ___ bytes.

four

C++ provides a header file called ___, which is used for I/O.

fstream

The heading of the function is also called the ____.

function header

The term GB refers to ____.

gigabyte

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

false

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

False, it stop when its greater than or equal to 20.

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

!=

Putting ___ in front of a logical expression reverses the value of that logical expression.

!

Which of the following operators has the highest precedence?

!

What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) cout << list[j] << " "; cout << endl;

0 5 10 15 20

Assume you have the following declaration char nameList[100]; Which of the following ranges is valid for the index of the array namelist?

0 through 99

Assume you have three int variables: x=2, y=6, and z. Choose the value of z in the following expression: z= (y/x>0) ? x:y;

2

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

2

Suppose that x= 25.67, y= 356.876, and z = 7623.9674 decimal point 2

25.67 356.88 7623.97

A sequence of eight bits is called a ____.

byte

A function ____ is a function that is not fully coded

stub

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

Digital signals

The ___ handles the overall activity of the computer and provides services such as memory management, input/output activities, and storage management.

OS (Operating system)

Which statement below about prototypes and headers is true?

Prototypes end with a semicolon, but headers do not.

Main memory is called ____.

Random Access Memory RAM Information

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

True

Which of the following is the newline character?

\n

A variable or expression listed in a call to a function is called the ___.

actual parameter

A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time is called a(n) ____.

algorithm

Suppose that alpha is an int variable and ch is a char variable. The input is: 17A

alpha = 17, ch = 'A'

Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statments ___.

alpha = beta; beta = beta +1;

Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statments ___.

beta = beta +1; alpha = beta;

The digit 0 or 1 is called a binary digit, or ____.

bit

The ____ statement is typically used for two purposes:To exit early from a loop.To skip the remainder of a switch structure.

break

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

int a,b,c;

What does <= mean?

less than or equal to

A program that loads an executable program into main memory is called a(n) ___.

loader

Suppose that outFile is an ofstream variable and output is to be stored in the file outputData.out. Which of the following statements open the file outputData.out and associates outFile to the output file?

outFile.open("outputData.out");

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

output

If the score is equal to 75, the value of the grade is " "

pass

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

predefined

In a C++ program, statements that begin with the symbol # are called ___ directives

preprocessor

In a while and for loop, the loop condition is evaluated before executing the body of the loop. Therefore, while and for loops are called ____ loops.

pretest

Stream variable(for example, ifstream and ofstream) should be passed by ____ to a function.

reference

__ parameters are useful in three situations:When the value of the actual parameter needs to be changed.When you want to return more than one value from a function.when passing the address would save memory space and time relative to copying a large amount of data.

reference

What is the output of the following code? char lastInitial = 'S';

section 5

A semicolon at the end of the for statement (just before the body of the loop) is a(n) ____ error.

semantic

The term___ describes a process in which the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.

short-circuit evaluation

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


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

Nervous System Part B and Special Senses exam

View Set

Chapter 39- The Balance of Payments, Exchange Rates, and Trade Deficits

View Set

MIS 111 Exam 3 PARS, MIS 111 Exam 3 ICQs

View Set

Chapter 14 Sleep, Dreaming & Circadian Rhythms

View Set

the operation of the doctrine of precedent

View Set