A. any number.
B. number of the elements.
C. floating point number.
D. type of an array.
The syntax to declare an array is - type name[size]; Where "size" represents the number of elements in the array.
A. array number.
B. element number only.
C. arrayname[n].
D. array name only.
Elements of arrays are referred to as arrayname[n], where n refers to the index number of the elements.
A. different data types.
B. only float types.
C. only strings.
D. same data types.
An array is a collection of variables of the same data type that are referenced by a common name.
A. discrete memory locatons.
B. contiguous memory locations.
C. different memory location names.
D. virtual memory.
An array is a collection of variables of the same type that are referenced by a common name. All arrays consist of contiguous memory location.
A. constant.
B. floating point variable of the array.
C. variable.
D. base type of the array.
Data type declares the base type of the array, which is the type of each element in the array.
A. be accessed as elements of the character array.
B. not be accessed as elements of character array.
C. be accessed as elemenys of floating point array.
D. can't be accessed as elements of floating point array.
Individual characters of a string can be easily accessed as they are the elements of the character array.
A. a variable type.
B. declared and defined before using it.
C. declared only.
D. indexed.
Array should be declared as well as defined before it can be used to store information.
A. basic data type.
B. basic integer data type.
C. basic floating point data type.
D. derived data type.
An array is a derived data type that is based on other basic data types. It is a collection of variables of the same type that are referenced by a common name.
A. char strg[15].
B. char strg[16].
C. float strg[15].
D. int strg[16].
The syntax to declare an array that holds characters is type name[size]; So it will be char strg[15];
A. equivalent.
B. mandatory to mension.
C. optional.
D. one-dimensional.
In multi-dimensional array it is necessary to mension the size of the array but the size of the first dimension is optional.
A. int x[5][2];
B. int n[][]=25;
C. float y[10];
D. char str[50];
While defining a two-dimensional array it is necessary to declare the size. In 2-D array the size of first dimension is optional but we need to mention the second dimension.
A. if else structure.
B. a single loop.
C. nested loops.
D. condition checking.
To access the elements of two-dimensional array we can use nested loop. Example of a code to access an array A[3][3] is given below - for(i=0;i<3;i++) { for(j=0;j<3;j++) { cin>>A[i][j]; } }
A. string.
B. character.
C. characters.
D. integer.
C++ does not have a string data type rather it implements string as single-dimensional character array.
The error in the above code is in the following statement:
age =25
cout < < e.name < < age;
In C language, we can declare only the member variables, whereas, a C++ structure can hold data members as well as member functions.
A structure is a collection of variable types grouped together. You can refer to a structure as a single variable and to its parts as members of that variable by using the dot (.) operator.


|
|
|
|
|
|
|
|
|
while printing signature and status, v[i].signature and v[i].status should be used.

There are several important uses of the typedef statement.
(i) It helps in effective documentation of a program, thus increasing its clarity. It enhances ease of maintenance of the program.
(ii) It is used for declaring new data types involving structures.
(iii) Usage of typedef is in writing portable programs. The sizes of different data types are dependent on the compiler. For instance, the size of an integer is two bytes on a 16-bit compiler and four bytes on a 32-bit compiler. Portability is achieved by type-declaring an integer as follows:
typedef long int INT;
{01,”Amit”,{76.0,56.5,67.0}}, //struct 0
{04,”Neha”,{71.0,69.0,57.0}}, //struct 3
A. a float value.
B. a double or long value.
C. an integer value or integer constant without any sign.
D. a char value.
The size of an array defines how many elements the array will hold. It must be an integer value or integer constant without any sign.
A. type array-name [size]:
B. type array-name [size];
C. type array-name;
D. array-name [size];
An array declaration specifies a variable type and a name along with size, to specify the number of data items the array will contain. The declaration should be terminated by semicolon.
A. constant.
B. floating point variable of the array.
C. variable.
D. base type of the array.
Array is a data structure consisting of a group of elements that are accessed by indexing. Each element of an array has the same data type and the array occupies a contiguous area of storage.
A. not an array.
B. single dimensional array.
C. multi dimensional array.
D. two dimensional array.
The syntax of single dimension array is “datatype arrayname[size]” whereas multi dimension arrays are accessed using more than one index. For example names[][].
A. a[0], a[1], a[2], a[3].
B. a[1], a[2], a[3], a[4].
C. a[1], a[2], a[3].
D. a[0], a[1], a[2], a[3], a[4].
The array a[4]contains four elements. In c++ subscripts of an array starts with the 0.
A. 19 elements from students [1] to students [19].
B. 20 elements from students [0] to students [19].
C. 21 elements from students [0] to students [20].
D. 20 elements from students [1] to students [20].
The given statement "char names[20]" declares an array of names of base type char, which can hold 20 elements.
A. 30 elements from students [1] to students [30].
B. 29 elements from students [1] to students [29].
C. 30 elements from students [0] to students [29].
D. 31 elements from students [0] to students [30].
The statement "int students[30];" declares an array of students of base type int, which can hold 30 elements. The index of an array always starts from 0 to (n-1).
A. base address.
B. highest address.
C. homogeous address.
D. contiguous adress.
An Array always stores element in the contiguous memory location. The address of the first element is also known as the base address of the array.
A. single-dimensional array.
B. three-dimensional array.
C. two-dimensional array.
D. data structure.
Matrix is a useful concept of mathematics. Matrices can be represented through 2-D (two-dimensional) arrays.
A. number of strings.
B. base type of strings.
C. length of strings.
D. dimension of strings.
An array of strings is a two-dimensional character array. the size of first index(rows) determines the number of strings and the size of second index(columns) determines maximum length of each string. So subscript 5 will determine the number of strings.
A. 2 1.
B. 2 2.
C. 1 1.
D. 1 2.
In C++ language integer takes 2 bytes in memory and char takes 1 byte in memory.
A. there is not a getch() function.
B. c cannot be passed as an argument. It should be c[].
C. string.h header file is not defined.
D. there is no return statement for main ().
“string.h” header file has defined string functions in it like strlen, strcpy. These functions cannot be used without using string.h header file.
A. char city[]={‘c’,’a’,’l’,’c’,’u’,’t’,’t’,’a’ }
B. char city[]=”calcutta”;
C. char prod_name[30]=”Inverters”
D. char city[]={‘c’,’a’,’l’,’c’,’u’,’t’,’t’,’a’ };
In the following statement char city[] = {'c','a','l','c','u','t','t','a'} semi-colon is missing. So it is an illegal statement in C++.
A. valid.
B. invalid.
C. legal.
D. none of the above
In float x[n] n has to be a constant.
A. passed by reference.
B. passed by parameter.
C. passed by value.
D. passed by constant.
In a function the arrays are passed by reference.
A. the last element entered from the keyboard.
B. terminating (;)
C. the last element.
D. null character.
null character marks the end of a string.
A. 96
B. 68
C. 57
D. 0
In the two-dimensional array the first index points to the row number and second index points to the column number. the index [0][0] will give access to the element of 0th row and 0th column i.e. 68.
A. calculated using the formula.
B. not calculated.
C. automatically calculated.
D. need a calculator to calculate.
Compiler automatically calculates the dimensions of the arrays in an unsized array.
A. dimension.
B. program.
C. function.
D. multi-dimensional array.
Like other variables an array can be passed in a function as parameter.
A. 15 bytes
B. 14 bytes
C. 1 byte
D. 16 bytes
In a single-dimensional array total bytes required by it is always dependent on the type and size of dimensions. here total required byte is calculated using the formula - sizeof(type) X size of the dimension i.e. 1 X 15 = 15. char size is 1.
struct distance
{
float feet;
float inches;
};
struct time
{
int hrs;
int mins;
int secs;
};
struct tour
{
distance d1;
time t1;
};
struct Student
The entire structure can be passed to the function both ways:
(i) By value and (ii) By reference
Call-by-Value: When a structure is used as an argument to a function, the entire structure is passed using the standard call-by-value method. Of course, this means that any changes made to the contents of the structure inside the function to which it is passed do not affect the structure used as an argument.
Call-by-Reference: Structures can be passed by reference just as other simple types. When a structure is passed by reference, the called function declares a reference for the passed structure and refers to the original structure elements through its reference. Thus, the called function works with the original values.
A. int marks[20];
B. float a[+40];
C. float amt[35];
D. float m[7];
The array size must be an unsigned integer constant. The correct form is : float a[40];
A. char name[20];
B. double[40];
C. int st[30];
D. float m[7];
The name of the array is missing. The correct form is : double arrayname[40];
A. int score[20];
B. int adi[4];
C. amt[35] of float;
D. float m[7];
The base type cannot appear after array name and size . The correct form is: float amt[35];
A. first element;
B. last element;
C. middle element;
D. second last element;
In C++, all arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.
A. prototype.
B. reference.
C. scope.
D. static.
In computer programming, scope is an enclosing context where values and expressions are associated. It decides the lifetime of a variable or function.
A. 50.
B. 100.
C. 150.
D. 200.
The total number of bytes required = number of rows X number of columns X sizeof(base type). The bytes occupied by a long variable or element is 4 bytes. So the total bytes occupied by the array A is 5 X 10 X 4=200.
A. 34.
B. 36.
C. 68.
D. 136.
The total number of bytes required = number of rows X number of columns X size(of base type). Short is 2 bytes. So, 34X2 =68.
A. 0.
B. 30.
C. 34.
D. 43.
The number of elements in the array A is 34 as it is the one-dimensional array.
A. address of its first element.
B. address of its last element.
C. address of its second last element.
D. value of its first element.
C++ treats the name of an array as a pointer, i.e., memory address of the first element of the array.
A. 45.
B. 200.
C. 35.
D. 20.
Number of elements in the array a[m][n] = number of rows (m) X number of columns(n). So the number of elements in the array A[5][40] is 200.
A. has elements of different data type.
B. has elements of the same data type.
C. has elements of the same struct type.
D. can also define a structure within it.
An array is a collection of elements of the same data type, that occupies contiguous memory locations.
A. aditi.
B. priyanka.
C. Namo.
D. mudita.
One space is needed for null character, which acts as a termination symbol.
A. stack of elements.
B. multicolumn table.
C. multi grid.
D. single grid.
An array can also be visualize as a stack of elements.
A. code dependent.
B. compiler dependent.
C. programmer dependent.
D. linker dependent.
C++ does not provide any limitations on the number of dimensions in multi-dimensional array. It is always compiler dependent.
A. uninitialized array.
B. unsized array.
C. sized array.
D. incomplete array.
C++ allows us to skip the size of the array in an array initialization statement. This is called as unsized array initialization.
A. 192
B. 18.
C. 24.
D. 96.
The size of a 2-D array is calculated as rows x columns x size of array’s base type. Here, the array base type is double, which is equal to 8 bytes. Hence, 8 x 6 x 4 =192.
A. 30.
B. 11.
C. 120.
D. 16.
The size of a 2-D array is calculated as rows x columns x size of array’s base type. Here, it will be 4 x 6 x 5 =120.
A. column–row matrix.
B. column-column matrix.
C. row-row matrix.
D. row-column matrix.
In two-dimensional arrays, the first index indicates the row and the second index indicates the column.
A. 9.
B. 20.
C. 5.
D. 4.
The number of elements in an array can be calculated as number of elements in rows x number of elements in columns.
A. 6.
B. 24
C. 12.
D. 20.
The size of a 1-D array is calculated as number of elements in an array x size of an array's base type. Here, base type is float, which takes 4 bytes. It takes 24 bytes for its storage .i.e. 4x6 = 24.
A. 10.
B. 20.
C. 30.
D. 40.
The size of a 1-D array is calculated as number of elements in an array x size of an array‘s base type. Here, base type is int, which takes 2 bytes. It takes 20 bytes for its storage i.e. 2X10 = 20.
A. 0.
B. 1.
C. 64.
D. 20.
A string is a one-dimensional character array which requires one extra character i.e. null character to indicate the termination of the string.
A. two bytes.
B. one byte.
C. four bytes.
D. ten bytes.
In C++ an integer element occupies 2 bytes in memory.
A. dynamic memory location.
B. static memory location.
C. contiguous memory location.
D. non-contiguous memory location.
In one-dimensional array, elements are stored in contiguous memory locations.
A. homogeneous data structure.
B. non-homogeneous data structure.
C. linear data structure.
D. non-linear data structure.
Data structures like trees, binary trees, graphs and heaps are non-linear data structures, as the elements are stored in random order.
A. homogeneous data structure.
B. non-homogeneous data structure.
C. linear data structure.
D. non-linear data structure.
A data structure is said to be linear if its elements form a sequence or a linear list. For example - Arrays and Linked List
A. homogeneous data structure.
B. non- homogeneous data structure.
C. static data structure.
D. dynamic data structure.
The data structure, which contains different types of data, is known as non-homogeneous data structure.
A. homogeneous data structure.
B. non- homogeneous data structure.
C. static data structure.
D. dynamic data structure.
When items or entities in a group are similar, then they are said to be homogeneous. Similarly, when the elements of the data structure are of the same type,then it is known as homogeneous data structure.
A. initial address.
B. flag address.
C. cell address.
D. base address.
In computing, a base address is an address serving as a reference point ("base") for other addresses.
A. data type.
B. single dimensional character arrays.
C. two dimensional character arrays.
D. multi dimensional character arrays.
A string of characters is stored in successive elements of a character array and terminated by the null character.
A. row major order only.
B. column major order only .
C. cell major order only.
D. row major or column major order.
A 2-D array stores the elements row-wise as well as column-wise as it is a two-dimensional array which stores the element in the form of row and column.
A. structure.
B. arrays.
C. queues.
D. trees.
An array is a data structure consisting of a group of elements of same type that are accessed by indexing.
A. msg[0] to msg[4] and msg[5] for null character.
B. msg[1] to msg[5] and no space for null character needed.
C. msg[0] for null character and msg[1] to msg[5] for Hello.
D. msg[0] to msg[4] and no space for null character needed.
A string of characters is stored in successive elements of a character array and terminated by the null character. The array subscripts in C++ starts with number 0 and not 1. So, msg[5] will be used by null character.
A. string.
B. elements.
C. integer.
D. character.
A string of characters is stored in successive elements of a character array and is terminated by the null character.
A. tag.
B. typedef.
C. enum.
D. S1.
Tag, the type name given to the structure becomes a reserved word within the scope of the structure.
A. the members are being passed by reference.
B. the first one is passed by value and the other by reference.
C. the members are being passed by value.
D. we cannot tell how the members are being passed.
When a structure is used as an argument to a function, the entire structure is passed using the standard call by value method.
A. another class.
B. literal.
C. another structure.
D. array.
A structure may be defined as a member of another structure. In such structures, the declaration of the embedded structure must appear before the declarations of other structures.
A. directories.
B. functions.
C. derivatives.
D. directives.
Preprocessor commands are called Directives, and begin with a pound / hash symbol(#). No white space should appear before the #, and a semicolon is NOT required at the end.
A. a new user defined structure.
B. a new data type.
C. an alias for an existing data type.
D. new variables for an existing data type.
typedef does not actually create a new data class, rather it defines a new name for an existing data type.
A. can have elements of different data type.
B. always has elements of the same data type.
C. will have elements of the same struct data type.
D. can also define a structure within it.
An array is a collection of variables of same data type. Since an array contains similar elements, the combination having structures within an array is an array of structures.
A. original values are not to be changed.
B. receiving parameter does not match.
C. component members be assigned values directly.
D. original values are to be changed.