Comp Sci Review

d. (1 1 1… and on forever)
What is the output of the following code segment?

n=1;
while (n<= 5) cout <

c. (null statement)
If you place a semicolon after the test expression in a while loop, it is assumed to be aNo:
Select one:
a. pre-test loop
b. post-test loop
c. null statement
d. infinite loop
e. None of these
We will write a custom essay sample on
Comp Sci Review
or any similar topic only for you
Order now
d. (continue)
This statement may be used to stop a loop’s current iteration and begin the next one.
Select one:
a. break
b. terminate
c. re-iterate
d. continue
e. None of these
b. (is true)
The while loop contains an expression that is tested for a true or false value, and a statement or block that is repeated as long as the expression:
Select one:
a. is false
b. is true
c. does not evaluate to true or false
d. evaluates to true or false
e. None of these
b. (counter)
This is a variable that is regularly incremented or decremented each time a loop iterates.
Select one:
a. constant
b. counter
c. control statement
d. null terminator
e. None of these
c. (7)
What will the following code display?

int number= 6;
number++;
cout <

c. (5)
What will the following code display?

int number= 6;
int x=0;
x=–number;
cout <

c. (buffer)
A file ________ is a small holding section of memory that file-bound information is first written to.

Select one:
a. name
b. number
c. buffer
d. segment
e. None of these

c. (closes a file)
Assuming dataFile is a file stream object, the statement:

dataFile.close();

Select one:
a. is illegal in C++
b. needs a filename argument to execute correctly
c. closes a file
d. is legal but risks losing valuable data
e. None of these

d. (3)
What will the following code display?

int x=0;
for(int count=0; count<3; count++) x+=count; cout <

f (False)
True/False: The increment and decrement operators can be used in mathematical expressions; however, they cannot be used in relational expressions.
Select one:
True
False
d. (int array[10];)
Which of the following is a valid C++ array definition?
Select one:
a. int array[0];
b. float $payments[10];
c. void numbers[5];
d. int array[10];
e. None of these
b. (all but the first dimension)
When writing functions that accept multi-dimensional arrays as arguments, ________ must be explicitly stated in the parameter list.
Select one:
a. all dimensions
b. all but the first dimension
c. the size declarator of the first dimension
d. all element values
e. None of these
c. (constant integer expression, zero)
An array’s size declarator must be a ________ with a value greater than ________.
Select one:
a. number, one
b. number, zero
c. constant integer expression, zero
d. variable, -1
e. None of these
d (begins with zero)
Subscript numbering in C++________.
Select one:
a. can be set at runtime
b. can begin with a programmer-defined value
c. varies from program to program
d. begins with zero
e. None of these
d. (range variable)
The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the ________.
Select one:
a. counter variable
b. i variable
c. iterator
d. range variable
e. None of these
a (one)
A two-dimensional array can have elements of ________ data type(s).
Select one:
a. one
b. two
c. four
d. Any of these
e. None of these
a. (legal in C++)
An array with no elements is ________.
Select one:
a. legal in C++
b. illegal in C++
c. automatically furnished one element, with a value of zero
d. automatically furnished one value—the null terminator
e. None of these
b. (legal in C++)
It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].
Select one:
a. illegal in C++
b. legal in C++
c. not recommended by the ANSI committee
d. not good programming practice
e. None of these
d (
87
66
55
)
What will the following code display?

int numbers={99,87,66,55,101};
for (int i=1; i<4; i++) cout<

d. (0)
What will the following code display?

int numbers[4]={99,87};
cout<

b. (vector n { 10, 20 };)
Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20?
Select one:
a. int vector n ({10}, {20});
b. vector n { 10, 20 };
c. vector n = {10, 20};
d. vector n(10, 20);
d. (It creates a vector object with a starting size of 10 and all elements are initialized with the value 2.)
What does the following statement do?

vector v(10,2);
Select one:
a. It creates a vector object with a starting size of 2 and the first element initialized with the value 10.
b. It creates a vector object and initializes all the first two elements with the values 10 and 2.
c. It creates a vector object with a starting size of 10 and the first element initialized with the value 2.
d. It creates a vector object with a starting size of 10 and all elements are initialized with the value 2.

f (False)
True/False: If you attempt to store data past an array’s boundaries, it is guaranteed that the compiler will issue an error.
Select one:
True
False
a. (fstream)
To allow file access in a program, you must #include this header file.
Select one:
a. fstream
b. cfile
c. file
d. fileaccess
d. (stream insertion operator)
This may be used to write information to a file.
Select one:
a. cout object
b. pen object
c. output object
d. stream insertion operator
e. None of these
d. (ofstream )
To write data to a file, you define an object of this data type.
Select one:
a. outputFile
b. fstream
c. ifstream
d. ofstream
a. (ifstream
)
To read data from a file, you define an object of this data type.
Select one:
a. ifstream
b. fstream
c. ofstream
d. inputFile
a. (outFile << number;)
Assuming outFile is a file stream object and number is a variable, which statement writes the contents of number to the file associated with outFile?
Select one:
a. outFile << number; b. write(outFile, number); c. outFile >> number;
d. number >> outFile;
b. (opened)
A file must be ________ before data can be written to or read from it.
Select one:
a. closed
b. opened
c. buffered
d. initialized
e. None of these
×

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out