Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
c__test.docx
Скачиваний:
30
Добавлен:
25.02.2016
Размер:
2.09 Mб
Скачать
  1. Find the error:

a)there are no errors in the code

b)error in line //1

c)error in line //2

d)error in line //3

e)error in line //4

  1. Absolute value of x:

a) exp(x)

b) floor(x)

c) fabs(x)

d) ceil(x)

e) sqrt(x)

  1. Format for function definition:

a)

b)

c)

d)

e)

  1. Modulus (remainder) operator:

a) #

b) &

c) %

d)[]

e){}

  1. Set of integers with identifiers

a) randomize

b) prototype

c) function

d) enumeration

e) returning

  1. 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

  1. 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) integer, string

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

a) name

b) subscript

c) type

d)string

e) dimension

  1. __________ should be used to declare the size of an array, because it makes the program more scalable

  1. Const variable

  2. Variable

  3. #include

  4. New variable

  5. string

  1. Using operator = for:

a) more than

b) less than

c) assignment

d) contrast

e) equality

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

a) ending

b) bubble

c) sorting

d) linear

e) initialized

  1. 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

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

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

b) double [ arraySize ] = { 0.0 };

c) double fractions= { 0.0 };

d) double fractions[ arraySize ];

e) no right answer

  1. Choose true statement:

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

  1. What will be in output:

a) 0 32

1 27

b) 0 32

1 13

c) 0 32

1 27

2 0

d) 0 32

27 1

e) 32 32

27 27

  1. What will be output?

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

  1. Array of characters is __________.

a) String b) vector c) name d) structure e) pointer

  1. What kind of library has vector:

a)#include <vector>

b)#include <vector.h>

c)#include <cvector>

d)#include <vstream>

e)#include <cvector.h>

  1. What cycles are useful for input-output and processing in arrays:

a)while, do

b)for, while

c)do, for

d)only for

e)all of the above;

  1. What does this code output?

a)0 1 4

b)0 0 0 1 4

c)1 0 4 0 0

d)4 0 1 0 0

e)1 0 4;

  1. What associativity and type has this symbol “&&”:

a)right to left, logical OR

b)right to left, logical AND

c)left to right, logical OR

d)left to right, logical AND

e)right to left, reference;

  1. What is the X?

a)memory unit

b)size of the array

c)address of the array

d)array unit

e)array element;

  1. Where is the error?

a)int in the prototype of function(3-line)

b)int in the function(10-line)

c)function must be above of int main()

d)function calls wrong

e)void doesn’t return;

  1. Which library should use for “std::setw”?

a) #include <iostream>

b)#include <iostream.h>

c)#include <conio.h>

d)#include <iomanip>

e)#include <fstream>;

  1. Which of the following is called the number of elements in a vector:

a)element of the vector

b)item in the vector

c)size of the vector

d)size of the array

e)all of the above;

  1. What does this code output?

a)nothing

b)This is not the hello message!

c)Hello world!

d)hello

e)Hello world! This is not the hello message! ;

  1. Which of the following is wrong?

a)array and vector haven’t a base type

b)array cannot change the length

c)vector: the same purpose as arrays

d)vector: except can change length while the program is running

e)vector stores a collection of values of its base type;

  1. Which of the following is a two-dimensional array?

a)int anarray[2][2];

b)array anarray[2][2];

c)int array[2,2];

d)char array[2];

e)char anarray[2];

  1. Which of the following gives the memory address of the first element in array a

a)a[0];

b)&a;

c)a;

d)a[1];

e)&a(1);

  1. Which of the following correctly accesses the third element stored in a, an array with 50 elements?

a)a[3];

b)a(3);

c)a;

d)a[2];

e)a(2);

  1. What will be output after this code:

a)8 8;

b)8 9;

c)9 9;

d)9 10;

e)8 10;

  1. Which of the following is incorrect?

a)cout << b[ 0, 1 ];

b)cout << b[ 0 ][ 1 ];

c)cout << b[ 1 ][ 0 ];

d)cout << b[ 0 ] ;

e)cout << b[ 0 ][ 1 ][ 2 ][ 3 ][ 5 ];

  1. Find the correct declared vector.

a)int <vector> v;

b)int <vector> v(10);

c)<vector> int v;

d)vector <int> v;

e)<int> vector v(10);

  1. What will be the output?

a)2

b)4

c)nothing

d) 2 and 4

e)0

  1. Find the wrong initialize.

a)a[ ]={5,2,8,1,6};

b)a[ 3 ]={4,7,9,4};

c)a[ 5 ]={6,2,8,9,1};

d)a[ 4 ]={1,9,2};

e)a[ 2 ]={1,2};

  1. How many bytes one integer occupies in the memory?

a)2 bytes

b)8 bytes

c)4 bytes

d)32 bytes

e)16 bytes

  1. The number of elements in a vector is called:

a)size of vector

b)length of vector

c)index

d)numbers of vector

e)value of vector

  1. Which of the following false for array?

a)change the length

b)has a base type

c)stores a collection of values of its base type

d)has data type

  1. What will be output?

a)2 5 90 3 8

b)2 3 5 3 65 8 4

c)nothing

d)2 8 3 4

e)0

  1. The elements of an array are related by the fact that they have the same ____ and_____.

a)length and width

b)name and type

c)value and variable

d)length and value

e)type and variable

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

a)number

b)element

c)value

d)size

e)index

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