COP 3104 Chapter 5, 6, 7 True/False

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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

True

a *while* loop is somewhat limited because the counter can only be incremented by one each time through the loop

false

the condition that is tested by a *while* loop must be enclosed in parentheses and terminated with a semicolon

false

the increment and decrement operators can be used in mathematical expressions; however, they cannot be used in relational expressions

false

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

false

you may nest *while* and *do-while* loops but you may not nest *for* loops

false

you may not use both *break* and *continue* statements within the same set of nested loops

false

you may not use the *break* statement in a nested loop

false

if you want to stop a loop before it goes through all of its iterations, the *break* statement may be used

true

it is possible to define a file stream object and open a file in one statement

true

multiple relational expressions cannot be placed into the test condition of a *for* loop

true

the update expression of a *for* loop can contain more than one statement, for example: *for(i = 5; i < 10; i++, total += sales)*

true

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

False

C++ limits the number of array dimensions to two

False

If you attempt to store data past an array's boundaries, it is guaranteed to cause a compiler error

False

In C++11 the range-based *for* loop is best used in situations where you need the element subscript for some purpose

False

Local variables are initialized to zero by default

False

The following statement is a valid C++ definition: double money[25,00];

False

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

False

You must always furnish an argument with a function call

False

In C++11 you cannot use a range-based *for* loop to modify the contents of an array unless you declare the range variable as a reference variable

True

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

True

It is possible for a function to have some parameters with default arguments and some without

True

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

True

The amount of memory used by an array depends on the array's data type and the number of elements in the array

True

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

True

A function's return data type must be the same as the function's parameters

False

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

False

Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function

False

An array initialization must be all on one line

False

A *vector* object automatically expands in size to accommodate the items stored in it

True

A parameter is a special purpose variable that is declared inside the parentheses of a function definition

True

A static variable that is defined within a function is initalized only once, the first time it is called

True

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

True

Each individual element of an array can be accessed by the array name and the element subscript

True

Global variables are initialized to zero by default

True

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

True

a *while* loop's body can contain multiple statements, as long as they are enclosed in braces

true

*string* objects have a member function named *c_str* that returns the contents of the object formatted as a null-terminated C-string

true

An initialization expression may be omitted from the for loop if no initialization is required.

true

In C++ 11 you can pass a string object as argument to a file stream object's *open* member function.

true

an output file is a file that data is written to

true


Set pelajaran terkait

AH1 PREPU - Chapter 40 (Musculoskeletal)

View Set

HA&P Pearson Module Ch. 2 Part 1

View Set