Home Tuitions

Chapter-Structured Data Type: Array

Important MCQ questions for Class 11 Computer Science Chapter-Structured Data Type: Array

Get Important MCQ questions for Class 11 Computer Science Chapter-Structured Data Type: Array with a detailed explanation of all the MCQ questions asked from Chapter-Structured Data Type: Array prepared by the experts. 

Get Selected MCQ-based questions with solutions for Chapter-Structured Data Type: Array

MCQ Questions set-1 for chapter-Structured Data Type: Array class 11 Computer Science 

Computer Science - MCQ on Structured Data Type: Array

Class XI

Q. 1. The first element in an array corresponds to the

a. lowest address.

b. highest address.

c. middle element address.

d. second element address leaving first element space for null character.

Answer:

(a)

Explanation: All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address corresponds to the last element.

Q. 2. The array int students [30]; can hold

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

Answer:

(c)

Explanation: The statement declares an array of students of base type int, which can hold 30 elements.

Q.3. The array char names[20]; can hold

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

Answer:

(b)

Explanation: The statement declares an array of names of base type char, which can hold 20 elements.

Q. 4. The array a[4] will contain elements

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

Answer:

(a)

Explanation: a[4] means it contains four elements. The array subscripts in C++ starts with number 0 and not 1.

Q. 5. The code “int marks [50]” used in one of the C++ program is

a. not an array.

b. single dimensional array.

c. multi dimensional array.

d. two dimensional array.

Answer:

(b)

Explanation: The syntax of single dimension array is “datatype arrayname[size]” whereas multi dimension arrays are accessed using more than one index. For example names[][].

Q.6. The data type of an array is known as

a. constant.

b. floating point variable of the array.

c. variable

d. base type of the array.

Answer:

(d)

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

Q. 7. The general form of an array declaration is

a. type array-name [size]:

b. type array-name [size];

c. type array-name;

d. array-name [size];

Answer:

(b)

Explanation: An array definition 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.

Q.8. The size of an array must be

a. a float value.

b. a double or long value.

c. an integer value or integer constant without any sign.

d. a char value.

Answer:

(c)

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

Q. 9. A character array is also known as

a. character string.

b. array.

c. integer.

d. character.

Answer:

(a)

Explanation: A string of characters is stored in successive elements of a character array and terminated by the null character.

Q. 10. The string “Hello” is stored in a character array, msg[]. The element of msg[] are stored in

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.

Answer:

(a)

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

Q.11. The list of finite number n of similar data elements is known as

a. structure.

b. arrays.

c. queues.

d. trees.

Answer:

(b)

Explanation: An array is a data structure consisting of a group of elements of same type that are accessed by indexing.

Q.12. For two dimensional array, the computer memory is allotted in a

a. row major form.

b. column major form.

c. cell major form.

d. row major or column major form.

Answer:

(d)

Explanation: Row major form stores the 2-D array row wise and column major stores the 2-D array column wise.

Q. 13. C++ implements strings as a

a. data type.

b. single dimensional character arrays.

c. two dimensional character arrays.

d. multi dimensional character arrays.

Answer:

(b)

Explanation: A string of characters is stored in successive elements of a character array and terminated by the null character.

Q.14. In C++, the lower bound and the upper bound are represented by

a. size 0.5 and 1

b. size 0 and 1

c. size 0 and 10

d. size 0 and 0.5

Answer:

(b)

Explanation: Size specifies the number of elements in the array.

Array size (length) = upper bound-lower bound+ 1

Q.15. The starting address of the very first element of an array is known as

a. initial address.

b. flag address.

c. cell address.

d. base address.

Answer:

(d)

Explanation: In computing, a base address is an address serving as a reference point ("base") for other addresses.

Q.16. The search which can only work for sorted arrays is known as

a. linear search.

b. binary search.

c. Lsearch

d. multilevel search.

Answer:

(b)

Explanation: In computer science, a binary search algorithm is a technique for
locating a particular value in a sorted list.

Q.17. The data structure whose size, structure and associated locations are fixed at compile time is known as

a. homogeneous data structure.

b. non-homogeneous data structure.

c. static data structure.

d. dynamic data structure.

Answer:

(c)

Explanation: In computer science, a static data structure is a data structure created for an input data set, which is not supposed to change within the scope of the problem.

Q.18. When all the elements of the data structure are of same type, then it is known as

a. homogeneous data structure.

b. non- homogeneous data structure.

c. static data structure.

d. dynamic data structure.

Answer:

(a)

Explanation: 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 same type, then it is homogeneous data structure.

Q.19. When all the elements of the data structure is not of same type, then it is known as

a. homogeneous data structure.

b. non- homogeneous data structure.

c. static data structure.

d. dynamic data structure.

Answer:

(b)

Explanation: The data structure, which contains different types of data, is known as non-homogeneous data structure.

Q.20. The data structure in which the elements are stored sequentially, is known as

a. homogeneous data structure.

b. non-homogeneous data structure.

c. linear data structure.

d. non-linear data structure.

Answer:

(c)

Explanation: A linear data structure is one in which, while traversing sequentially, we can reach only one element directly from another. For example - Linked List, Array.

Q.21. The data structure in which the elements are stored randomly, is known as

a. homogeneous data structure.

b. non-homogeneous data structure.

c. linear data structure.

d. non-linear data structure.

Answer:

(d)

Explanation: Data structures like trees, binary trees, graphs and heaps are non-linear data structures, as the elements are stored without any order.

Q.22. The pre-condition for the binary search is that

a. the array should be linear.

b. the array should be sorted.

c. the array should be homogeneous.

d. the array should be non-linear.

Answer:

(b)

Explanation: In computer science, a binary search algorithm is a technique for locating a particular value in a sorted list.

Q.23. Elements of one-dimensional array are stored in

a. dynamic memory location.

b. static memory location.

c. contiguous memory location.

d. non-contiguous memory location.

Answer:

(c)

Explanation: In one-dimensional array, elements are stored in adjacent memory locations.

Q.24. The number of bytes used to store one element is known as

a. element size.

b. element weight.

c. element capacity.

d. element store.

Answer:

(a)

Explanation: Element size is the space that the element needs for the storage purpose.

Q.25. The ASCII value for null character is

a. 0

b. 1.

c. 64.

d. 20

Answer:

(a)

Explanation: To accommodate the terminating null character, the size of an array that houses a string must be at least one greater than the expected maximum size of a string.

MCQ Questions set-2 for chapter-Structured Data Type: Array class 11 Computer Science 

Q. 26. The size of int array a [10] is

a. 10.

b. 20.

c. 30.

d. 40.

Answer:

(b)

Explanation: The size of a 1-D array is calculated as number of elements in array x size of array‘s base type. Here base type is int, which takes 2 bytes. It takes 20 bytes for its storage as 2X10 = 20.

Q. 27. The size of float array a [6] is

a. 6.

b. 10.

c. 12.

d. 24.

Answer:

(d)

Explanation: The size of a 1-D array is calculated as number of elements in array x size of array ‘s base type. Here base type is float, which takes 4 bytes. It takes 24 bytes for its storage as 4x6 = 24.

Q. 28. The number of elements in an array Z[5][4] is

a. 9.

b. 20.

c. 5.

d. 4.

Answer:

(b)

Explanation: The number of elements in an array can be calculated as number of elements in rows x number of elements in columns.

Q. 29. Two-dimensional arrays are stored in

a. column–row matrix.

b. column-column matrix.

c. row-row matrix.

d. row-column matrix.

Answer:

(d)

Explanation: In two-dimensional arrays, the first index indicates the row and the second indicates the column.

Q. 30. The size of float array a [6][5] is

a. 30

b. 11

c. 120

d. 16

Answer:

(c)

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

Q. 31. The size of double array a[6][4] is

a. 192

b. 18

c. 24

d. 96

Answer:

(a)

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

Q. 32. We can have multidimensional arrays in C++. The maximum limit of dimensions is

a. compiler independent.

b. compiler dependent.

c. programmer dependent.

d. 5- dimensional array.

Answer:

(b)

Explanation: Variable and fixed length arrays do not have a maximum size limit. The maximum limit of multidimensional arrays depends on the compiler.

Q. 33. One dimensional array can be visualized as a

a. stack of elements.

b. multicolumn table.

c. multi grid.

d. single grid.

Answer:

(b)

Explanation: Only two-dimensional arrays can be visualized as a multicolumn or grid and not one-dimensional.

Q. 34. We can create arrays by

a. first assigning variable name to array object, then assign values to the array.

b. first assigning values to the array, then assigning variable name to array object.

c. only assigning variable name to array object.

d. only assigning value to the array.

Answer:

(a)

Explanation: C++ provides the facility of array initialization at the time of declaration.

Q.35. The errors in the code below is

#include<iostream.h>

void main()

{

char c[]=”c++ is easy”;

int i = strlen (c) ;

cout<< i ;

}

a. no error.

b. c cannot be passed as an argument. It should be c[].

c. string.h header file is not defined.

d. no return statement for main ().

Answer:

(c)

Explanation: “string.h” header file has defined string functions in it like strlen, strcpy. These functions cannot be used without using string.h header file.

Q. 36. The value which can be assigned to char names[6] is

a. aditi.

b. priyanka.

c. amrita.

d. mudita.

Answer:

(a)

Explanation: One space is needed for null character, which acts as a termination symbol.

Q.37. The correct output of the following program is

#include<iostream.h>

void main()

{

int i ;

cout<<sizeof (i) <<endl<< sizeof (‘i’);

}

a. 2 1.

b. 2 2.

c. 1 1.

d. 1 2.

Answer:

(a)

Explanation: Integer takes 2 bytes memory and char takes 1 byte memory in c++.

Q.38. The errors in the code below is

#include<iostream.h>

void main()

{

char c[]=”c++ is easy”;

int i = strlen (c) ;

cout<< i ;

}

a. no error.

b. c cannot be passed as an argument. It should be c[].

c. string.h header file is not defined.

d. no return statement for main ().

Answer:

(c)

Explanation: “string.h” header file has defined string functions in it like strlen, strcpy. These functions cannot be used without using string.h header file.

Q. 39. An array in a structure

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.

Answer:

(b)

Explanation: An array is a collection of elements of same data type, which occupies contiguous memory locations.

Q. 40. The array in which first dimension is missing is called

a. uninitialized array.

b. unsized array.

c. sized array.

d. incomplete array.

Answer:

(b)

Explanation: C++ allows us to skip the size of the array in an array initialization statement. This is called an unsized array initialization.

Q. 41. In C++, the illegal array declaration is

a. float a[30];

b. double marks[20];

c. int score[20];

d. int ad [4];

Answer:

(d)

Explanation: There should not be any blank space in between an array name and the first square bracket. The correct form is int ad[4];

Q.42. In C++, the illegal array declaration is

a. int score[20];

b. int adi[4];

c. amt[35] of float;

d. float m[7];

Answer:

(c)

Explanation: The base type cannot appear after array name and size . The correct form is: float amt[35];

Q.43. In C++, the illegal array declaration is

a. char name[20];

b. double[40];

c. int st[30];

d. float m[7];

Answer:

(b)

Explanation: The name of the array is missing. The correct form is : double arrayname[40];

Q.44. In C++, the illegal array declaration is

a. int marks[20];

b. float a[+40];

c. float amt[35];

d. float m[7];

Answer:

(b)

Explanation: The array size must be unsigned integer constant. The correct form is : float a[40];

Q.45. C++ interprets the array name as the

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.

Answer:

(a)

Explanation: In C++, in most contexts the name of an array is treated as if it is a pointer, i.e., memory address of some element.

Q.46. The number of elements in array int A[5][40] are

a. 45

b. 200

c. 35

d. 20

Answer:

(b)

Explanation: Number of elements in array a[m][n] = number of rows (m) X number of columns(n).

Q47) The number of elements in array short A[34] are

a. 30

b. 43

c. 34

d. 0

Answer:

(c)

Explanation: Number of elements in array a[m] = m, when it is one dimensional array.

Q.48. The total number of bytes required to store array short A[34] are

a. 34

b. 68

c. 36

d. 136

Answer:

(b)

Explanation: The total number of bytes required are = number of rows X number of columns X size of (base type). Short is 2 bytes. So, 34X2 =68

Q.49. The total number of bytes required to store array long A[5][10] are

a. 300

b. 50

c. 100

d. 200

Answer:

(d)

Explanation: The total number of bytes required are = number of rows X number of columns X size of (base type). Long is 4 bytes. So, 5 X 10 X 4=200.

Q.50. The program path within which a function or a variable is accessible is called

a. prototype.

b. reference.

c. scope.

d. static.

Answer:

(c)

Explanation: In computer programming, scope is an enclosing context where values and expressions are associated.