CS

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

global

A ________ variable is declared outside all functions.

opened

A file must be ________ before data can be written to or read from it.

update

A for statement contains three expressions: initialization, test, and:

definition

A function ________ contains the statements that make up the function.

false

A local variable and a global variable may not have the same name within the same program.

nested loop

A loop that is inside another loop is called:

false

A statement that starts with a # is called a comment

rows, columns

A two-dimensional array can be viewed as ________ and ________.

initialization list

A(n) ________ can be used to specify the starting values of an array.

for loop

An array can easily be stepped through by using a:

the same data type

An array can store a group of values, but the values must be:

string names[5];

An array of string objects that will hold 5 names would be declared using which statement?

false

An example of a secondary storage device is a hard drive

true

An individual array element can be processed like any other type of C++ variable.

initialized, declared

Arrays may be ________ at the time they are ________.

true

As a rule of style, when writing an if statement you should indent the conditionally-executed statements.

false

Assume array1 and array2 are the names of arrays. To assign the contents of array2 to array1, you would use the following statement. array1 = array2;

subscript

By using the same ________ you can build relationships between data stored in two or more arrays

true

Each individual element of an array can be accessed by the array name and an element number, called a subscript.

true

Floating point constants are normally stored in memory as doubles

call

Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.

header

If a function does not have a prototype, default arguments may be specified in the function ________.

true

If an array is partially initialized, the uninitialized elements will be set to zero.

true

If the sub-expression on the left side of an && operator is false, the expression on the right side will not be checked.

true

If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked.

the compiler will interpret the semicolon as a null statement

If you place a semicolon after the statement if (x < y)

false

If you use a C++ key word as an identifier, your program will compile, link, but not execute.

for

If you want a user to enter exactly 20 values, which loop would be the best to use?

assignment

In C++ the = operator indicates:

initialization

In a for statement, this expression is executed only once.

appropriate range reasonableness division by zero, if division is taking place All of these

Input values should always be checked for:

legal in C++

It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].

true

It is not considered good programming practice to declare all of your variables globally.

false

Local variables are initialized to zero by default.

true

One reason for using functions is to break programs into manageable units, or modules.

begins with 0

Subscript numbering in C++

null terminator

The ________ is automatically appended to a character array when it is initialized with a string constant.

trailing else

The default section of a switch statement performs a similar task as the ________ portion of an if/else if statement.

post-test

The do-while loop is considered a(n) ________ loop.

false

The following code correctly determines whether x contains a value in the range of 0 through 100. if (x >= 0 && <= 100)

false

The scope of a variable declared in a for loop's initialization expression always extends beyond the body of the loop.

static local

The value in a(n) ________ variable persists between function calls.

static

The value in this type of local variable persists between function calls.

a statement or block that is repeated as long as the expression is true

The while loop has two important parts: an expression that is tested for a true or false value, and:

default

These types of arguments are passed to parameters automatically if no argument is provided in the function call.

function

This is a collection of statements that performs a specific task.

for

This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.

break

This statement causes a loop to terminate early.

continue

This statement may be used to stop a loop's current iteration and begin the next one.

subscript

To access an array element, use the array name and the element's:

name

To pass an array as an argument to a function, pass the ________ of the array.

arrays

Unlike regular variables, these can hold multiple values.

true

Variables need to be declared before they can be used.

true

What is the value of the following expression? true && true

false

When a function is called, flow of control moves to the function's prototype.

input validation

When a program lets the user know that an invalid choice has been made, this is known as:

zero

When a relational expression is false, it has the value ________.

nesting area

When an if statement is placed within the conditionally-executed code of another if statement, this is known as:

true

When you pass an array as an argument to a function, the function can modify the contents of the array.

preprocessor

Which of the following is not one of the five major components of a computer system? Preprocessor CPU Main memory I/O devices Secondary Storage

break

Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.

false

You may nest while and do-while loops, but you may not nest for loops.

false

You may not use the break and continue statements within the same set of nested loops.

true

You may use the exit( ) function to terminate a program, regardless of which control mechanism is executing.

false

You must furnish an argument with a function call.

true

You should be careful when using the equality operator to compare floating point values because of potential round-off errors.

Variable

_____________ represent storage locations in the computer's memory

false

when using the equality operator to compare integer values there will be potential round-off errors.


Kaugnay na mga set ng pag-aaral

FL DCF Child Care, Preschool Appropriate Practices (PSPR) (2019)

View Set

Lesson 2.5 Solving Equations with Absolute Value

View Set