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

In classes, if we declare object without keywords like public, which type will it be of?

a. private

b. public

c. protected

d. it won't have access specifier

How could you call in main the function input in object school of some class?

a. input()

b. input

c. school::input()

d. school::input

class student {string name, surname} Aibar; What is underlined?

a. Object of class student

b. member of class student

c. member of object student

d. parameter of class student

Which access specifier means that the member can be used only by the functions of this class?

a. private

b. public

c. protected

d. this specifier doesn't exist

Which is the right declaration of the object of structure student:

a. struct Aibar

b. struct student:Aibar

c. student Aibar

d. student.Aibar

There is one mistake in code, in which line?

a.1

b.2

c.3

d.4

e.5

Lists and tables of values can be stored in __________ or __________.

a) Arrays, Vectors b) Arrays, Pointers c) Vectors, Characters d) Vectors, Pointers e) no right answer

The elements of an array are related by the fact that they have the same ________ and ___________.

a) name, type b) type, character c) pointer, name d) character, variable e) no right answer

The number used to refer to a particular element of an array is called its ________.

a) name b) subscript c) type d) string e) no right answer

A(n) __________ should be used to declare the size of an array, because it makes the program more scalable.

a) const variable b) variable c) #include d) new variable e) no right answer

The process of placing the elements of an array in order is called ________ the array.

a) ending b) sorting c) rebounding d) initializing e) no right answer

The process of determining if an array contains a particular key value is called _________ the array.

a) searching b) sorting c) determining d) ending e) no right answer

An array that uses two subscripts is referred to as a(n) _________ array.

a) one-dimensional b) four-dimensional c) two-dimensional d) three-dimensional e) no right answer

Define a constant variable arraySize initialized to 5.

a) const int arraySize = 5; b) const arraySize = 5; c) int arraySize = 5 d) const int arraySize; e) no right answer

Declare an array with arraySize elements of type double, and initialize the elements to 0.

a) double fractions[ arraySize ] = { 0.0 };

b) doubl [ arraySize ] = { 0.0 };

c) double fractions= { 0.0 };

d) double fractions[ arraySize ];

e) no right answer

Find the error in each of the following program segments and correct the error:

arraySize = 10; // arraySize was declared const

a) const arraySize = 10; // arraySize was declared const

b) int arraySize = 10; // arraySize was declared const

c) const int arraySize = 10; // arraySize was declared const

d) int const arraySize = 10; // arraySize was declared const

e) no right answer

Which is it true?

a) Vector can change the length, array can't b) Array can change the length, vector can't c) Array has own library d) Vector doesn't has own library e) no right answer

What will be output?

#include <iostream>

using std::cout;

using std::endl;

#include <iomanip>

using std::setw;

int main()

{

int n[ 2 ] = { 32, 27};

cout << "Element" << setw( 13 ) << "Value" << endl;

for ( int i = 0; i < 2; i++ )

cout << setw( 7 ) << i << setw( 13 ) << n[ i ] << endl;

return 0;

}

a) Element Value

0 32

1 27

b) Value Element

0 32

1 27

c) Element Value

0 32

1 27

2 0

d) Value Element

0 32

27 1

e) Element Value

32 32

27 27

What will be output?

#include <iostream>

using std::cout;

using std::endl;

int main()

{

const int arraySize = 10;

int a[ arraySize ] = { 87, 68, 94, 100, 83, 78, 85, 91, 76, 87 };

int total = 0;

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

total += a[ i ];

cout << "Total of array elements: " << total << endl;

return 0;

}

}

a) Total of array elements:

b) Total of array elements: 849

c) Total of array elements: 87

d) 848

e) Total of array elements: 848

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