Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Akmaral c++.docx
Скачиваний:
20
Добавлен:
25.02.2016
Размер:
201.76 Кб
Скачать

Incorrect

Marks for this submission: 0/1.

Question 30

Marks: 1

Write a single statement that performs the specified task. Assume that floating-point variables number1 and number2 have been declared and that number1 has been initialized to 7.3. Assume that variable ptr is of type char *. Assume that arrays s1 and s2 are each 100-element char arrays that are initialized with string literals. Assign the address of variable number1 to pointer variable fPtr.

Choose one answer.

a. fPtr = *number1;

b. fPtr = &number1;

c. *fPtr = number1;

d. fPtr = *&number1;

Correct

Marks for this submission: 1/1.

Question 31

Marks: 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.

Choose one answer.

a. 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;

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 ( int i = 0; i < arraySize; i++ ) { cout << '[' << i << "] "; for ( int j = 0; j < arraySize; j++ ) cout << setw( 3 ) << table[ i ][ j ] << " "; cout << endl;

Incorrect

Marks for this submission: 0/1.

Question 32

Marks: 1

All arguments to function calls in C++ are passed by value

Answer:

True False

Correct

Marks for this submission: 1/1.

Question 33

Marks: 1

What is the output of the program?

#include<iostream>

usingnamespace std;

int main() {

char *a = "final exam";

cout << a+6;

return 0;

}

Choose one answer.

a. whitespace

b. exam

c. ASCII code of 'e'

d. e

e. address of a[6]

Incorrect

Marks for this submission: 0/1.

Question 34

Marks: 1

Write single C++ statements that input integer variable x with cin and >>

Answer:

Correct

Marks for this submission: 1/1.

Question 35

Marks: 1

Output the address of the variable myString of type char *

Choose one answer.

a. cout << static_cast< void >( myString );

b. cout << void * ( myString );

c. cout << static_cast< void * >( myString );

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