Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Preparation for Final Exam MCQ Quiz BIG.docx
Скачиваний:
16
Добавлен:
25.02.2016
Размер:
50 Кб
Скачать
☆

Int main() {

double y = 3;

double *x = &y;

cout << x << " " << x+1 << " " << *x+1;

return 0;

}

Выберите один ответ. a. 002BF7E0 002BF7E8 4

b. 002BF7E8 002BF7E0 4

c. None of the given choices.

d. 002BF7E4 002BF7E8 4

e. 3 4 002BF7E9

Question 62

Баллов: 1

Which of the following is a valid function call (assuming the function exists)?

Выберите один ответ. a. funct();

b. funct;

c. int funct();

d. int funct(int);

e. funct x, y;

Question 63

Баллов: 1

Find a correct declaration for a variable that is going to be used to set array size.

Выберите один ответ. a. int arraySize = 10;

b. const int arraySize = 10;

c. const arraySize = 10;

Question 64

Баллов: 1

What header file contains C++ file I/O instructions?

Выберите один ответ. a. infstream.h

b. fstream.h

c. iostream.h

d. file.h

e. outstream.h

Question 65

Баллов: 1

What punctuation is used to signal the beginning and end of code blocks?

Выберите один ответ. a. START and FINISH

b. BEGIN and END

c. { }

d. ( and )

e. -> and <-

Question 66

Баллов: 1

Write a program segment to print the values of each element of array table in tabular format with 3 rows and 3 columns.

Assume that the array was initialized with the declaration

int table[ arraySize ][ arraySize ] = { { 1, 8 }, { 2, 4, 6 }, { 5 } };

and the integer variables i and j are declared as control variables.

Выберите один ответ. a. cout << " [0] [1] [2]" << endl;

for ( int i = 0; i < arraySize; i++ ) {

cout << '[' << i << "] ";

for ( int j = 0; j < arraySize; j++ )

cout << setw( 3 ) << table[ i ][ j ] << " ";

cout << endl;

b. cout << " [0] [1] [2]" << endl;

for ( int i = 0; i < arraySize; i++ ) {

cout << '[' << i << "] ";

for ( int j = 0; j < arraySize; j++ )

cout << setw( 3 ) << table[ i ][ i ] << " ";

cout << endl;

c. cout << " [0] [1] [2]" << endl;

for ( i = 0; i < arraySize; i++ ) {

cout << '[' << i << "] ";

for ( j = 0; j < arraySize; j++ )

cout << setw( 3 ) << table[ i ][ j ] << " ";

cout << endl;

Question 67

Баллов: 1

Find the error in the following program segment. Assume the following declarations and statements:

int *zPtr; // zPtr will reference array z

int *aPtr = 0;

void *sPtr = 0;

int number;

int z[ 5 ] = { 1, 2, 3, 4, 5 };

// assign the value pointed to by sPtr to number

number = *sPtr;

Выберите один ответ. a. number = sPtr;

b. number = *sPtr;

c. number = *static_cast< int * >( sPtr );

Question 68

Баллов: 1

What value gets printed by the program?

#include <iostream>

Int main()

{

int x = 3;

switch(x)

{

case 0:

int x = 1;

std::cout << x << std::endl;

break;

case 3:

std::cout << x << std::endl;

break;

default:

x = 2;

std::cout << x << std::endl;

}

return 0;

}

Выберите один ответ. a. 0

b. 2

c. nothing, it is ill-formed

d. 1

e. 3

Question 69

Баллов: 1

Repeating a set of instructions a specific number of times is called repetition.

Question 70

Баллов: 1

What is the output of the program?

#include <iostream>

using namespace std;

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]