Chapter 1-5 C++

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

Which of the following statements is correct?

1. #include <iostream>

What header file do you need to include in a program that performs file operations?

1. #include<fstream>

Why should a program close a file when it's finished using it?

1. ? It may cause an unsaved data that might still be in it to become lost.

What is a flag and how does it work?

1. A flag is a variable that signals when some condition exits in the program.

Briefly describe how the && operator works.

1. Basically if 2 expressions are true than the compound expression will result as true.

Briefly describe how the || operator works

1. It as known as the or operated used for 2 expressions and becomes true when either one of them is true.

A(n) sentinel is

1. a special value that marks the end of a series of values.

A(n) running total is

1. a sum of numbers that accumulates with each iteration of a loop.

A(n) accumulator is

1. a variable that is initialized to some starting value, usually zero, then has numbers added to it in each iteration of a loop.

A loop that is inside another is called

1. a(n) nested loop.

The double log10(double var_name);

1. library function returns the base-10 logarithm of a number.

The double cos(double var_name);

1. library function returns the cosine of an angle.

The double exp(double var_name);

1. library function returns the exponential function of a number.

The double log(double var_name);

1. library function returns the natural logarithm of a number.

The double fmod(double var_name, double var_name2);

1. library function returns the remainder of a floating-point division.

The double sin(double var_name);

1. library function returns the sine of an angle.

The double pow(double var_name, double var_name2

1. library function returns the value of a number raised to a power.

If the subexpression on the left of the && logical operator is false, the right subexpression is

1. not checked.

Every complete statement ends with a

1. semicolon.

The for loop is ideal for

1. situations that require a counter.

The trailing else in an if/else if statement has a similar purpose as the default section of a

1. switch statement.

The break statement causes a loop

1. to terminate immediately.

The while and for loops

1. will not iterate at all if their test expressions are false to start with.

When do preprocessor directives execute?

Before the compiler complies your program.

A group statements, such as the contents of a function, is enclosed in

Braces {}

1. The job of the ___ is to fetch instructions, carry out the operations commanded by the instructions, and produce some outcome or resultant information.

CPU

1. Internally, the CPU consists of the ____ and the ___ .

Control Unit, ALU

A variable must be ____ before it can be used in a program.

Declared

The if statement regards an expression with the value 0 as

False.

1. The two general categories of software are ____ and ____ .

System and Application software

The if statement regards an expression with a nonzero value as

True

relational expression is either

True or False.

The value of a relational expression is 0 if the expression is False or 1 if the expression is

True.

A(n) ____ is a named storage location.

Variable

What is a file's read position? Where is the read position when a file is first opened for reading?

When a file is opened for input the file stream object internally maintains a special value known as a read position. A file's read position marks the location of the next byte that will be read form the file.

A left brace in a C++ program should always be followed by

a right brace later in the program.

A(n) counter is

a variable that "counts" the number of times a loop repeats.

The #include<math.h>

must be included in a program that uses the mathematical function

A program's ability to run on several different types of computer systems is called

portability

A loop that evaluates its test expression after each repetition is a(n)

postest loop.

The continue statement

causes a loop to skip the remaining statements in the current iteration.

The statement or block that is repeated is known as

the body of the loop.

For an if statement to conditionally execute a group of statements, the statements must be enclosed in a set of

curly braces.

Every C++ program must have a

function main

Each repetition of a loop is known as a(n)

iteration

The double sqrt(double var_name);

library function returns the square root of a number.

The double tan(double var_name);

library function returns the tangent of an angle.

Preprocessor directives begin with a

#

1. A(n) ____ ____ is an example of a secondary storage device.

Hard drive

1. languages are close to the level of humans in terms of readability.

High-level

What data type do you use when you want to create a file stream object that can read data from a file?

Ifstream data type object is used to create a file stream object that can read data from a file.

is information a program gathers from the outside world.

Input

Words that have special meaning in a programming language are called

Key words

languages are close to the level of the computer.

Low-level

1. Since computers can't be programmed in natural human language, algorithms must be written in a(n) ___ language

Machine

is the only language computers really process.

Machine

What data type do you use when you want to create a file stream object that can write data to a file?

Ofstream data type object is used to create a file stream object that can write data to a file.

are characters or symbols that perform operations on one or more operands

Operators

is information a program sends to the outside world.

Output

Words or names defined by the programmer are called

Programmer-defined identifiers

1. characters or symbols mark the beginning or end of programming statements, or separate items in a list.

Punctuation

An expression using the greater-than, less-than, greater-than-or-equal-to, less-than-or-equal-to, equal-to, or not-equal-to operator is called a(n)

Relational expression.

The do-while loop

always iterates at least once.

A(n) ___ ___ is a diagram that graphically illustrates the structure of a program.

hierarchy chart

A loop that does not have a way of stopping is a(n)

infinte loop.

1. The three primary activities of a program are

input , processing , and output .

The if/else if statement is actually a form of the

nested if statement.

If the subexpression on the left of the || logical operator is true, the right subexpression is

not checked.

A program is a set of

of instructions that the computer follows to perform as task

A loop that evaluates its test expression before each repetition is a(n)

pretest loop.

Computers can do many different jobs because they can be

programmed

The rules that must be followed when constructing a program are called

syntax


Kaugnay na mga set ng pag-aaral

CHAPTER 15-29: GERIATRIC NURSING 1ST SEM FINALS

View Set

Vet 265: Vaccines in companion animals

View Set

Chapter 32: Skin Integrity and Wound Care

View Set

Emily English 复习-1 07/23/2021

View Set