Array MCQ Questions – Array and Array Operations

You will see that all these Array MCQ Questions and answers packaged in this PDF file will help you prepare for any exam including GATE, GRE, IAS, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly. These Programming & IT questions and answers will surely be a great help for you.

1. Which of these best describes an array?

(A) A data structure that shows a hierarchical behaviour

(B) Container of objects of similar types

(C) Arrays are immutable once initialised

(D) Array is not a data structure

Answer: Container of objects of similar types

2. How do you initialize an array in C?

(A) int arr[3] = (1,2,3);

(B) int arr(3) = {1,2,3};

(C) int arr[3] = {1,2,3};

(D) int arr(3) = (1,2,3);

Answer: int arr[3] = {1,2,3};

3. How do you instantiate an array in Java?

(A) int arr[] = new int(3);

(B) int arr[];

(C) int arr[] = new int[3];

(D) int arr() = new int(3);

Answer: int arr[] = new int[3];

4. Which of the following is the correct way to declare a multidimensional array in Java?

(A) int[] arr;

(B) int arr[[]];

(C) int[][]arr;

(D) int[[]] arr;

Answer: int arr[[]];

5. In general, the index of the first element in an array is __________

(A) 0

(B) -1

(C) 2

(D) 1

Answer: 0

6. Elements in an array are accessed _____________

(A) randomly

(B) sequentially

(C) exponentially

(D) logarithmically

Answer: randomly

7. When does the ArrayIndexOutOfBoundsException occur?

(A) Compile-time

(B) Run-time

(C) Not an error

(D) Not an exception at all

Answer: Run-time

8. Which of the following concepts make extensive use of arrays?

(A) Binary trees

(B) Scheduling of processes

(C) Caching

(D) Spatial locality

Answer: Spatial locality

9. What are the advantages of arrays?

(A) Objects of mixed data types can be stored

(B) Elements in an array cannot be sorted

(C) Index of first element of an array is 1

(D) Easier to store elements of same data type

Answer: Easier to store elements of same data type

10. What are the disadvantages of arrays?

(A) Data structure like queue or stack cannot be implemented

(B) There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

(C) Index value of an array can be negative

(D) Elements are sequentially accessed

Answer: There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size.

11. Assuming int is of 4 bytes, what is the size of int arr[15];?

(A) 15

(B) 19

(C) 11

(D) 60

Answer: 60

12. In general, the index of the first element in an array is?

(A) 0

(B) -1

(C) 2

(D) 1

Answer: 0

13. Elements in an array are accessed?

(A) Randomly

(B) Sequentially

(C) Exponentially

(D) Logarithmically

Answer: Randomly

14. A mathematical-model with a collection of operations defined on that model is called:

(A) Data Structure

(B) Abstract Data Type

(C) Primitive Data Type

(D) Algorithm

Answer: Abstract Data Type

15. The information about an array that is used in a program will be stored in:

(A) symbol table

(B) activation record

(C) system table

(D) dope vector

Answer: dope vector

16. Which of the following abstract data types can be used to represent a many to many relation?

(A) Tree

(B) Plex

(C) Graph

(D) Both (b) and (c)

Answer: Both (b) and (c)

17. An algorithm is made up of 2 modules M1&M2. If order of M1 is f(n) & M2 is g(n) then the order of algorithm is?

(A) max (f(n),g(n))

(B) min (f(n),g(n))

(C) f(n) + g(n)

(D) f(n) X g(n)

Answer: min (f(n),g(n))

18. An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the number of comparisons?

(A) At least 2n-c comparisons, for some constant c, are needed.

(B) At most 1.5n-2 comparisons are needed.

(C) At least nlog2n comparisons are needed.

(D) None of the above.

Answer: At most 1.5n-2 comparisons are needed

19. The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is:

(A) Θ(n)

(B) Θ(logn)

(C) Θ(log*n)

(D) Θ(1)

Answer: Θ(logn)

20. Which of the following is an illegal array definition?

(A) Type COLONGE : (LIME, PINE, MUSK, MENTHOL); var a : array [COLONGE] of REAL;

(B) var a : array [REAL] of REAL;

(C) var a : array [‘A’…’Z’] of REAL;

(D) var a : array [BOOLEAN] of REAL;

Answer: var a : array [REAL] of REAL

21. Which of the following concepts make extensive use of arrays?

(A) Binary trees

(B) Scheduling of processes

(C) Caching

(D) Spatial locality

Answer: Spatial locality

22. Which of the following operations is not O(1) for an array of sorted data. You may assume that array elements are distinct:

(A) Find the ith largest element

(B) Delete an element

(C) Find the ith smallest element

(D) All of the above

Answer: Delete an element

23. Which of the following is not possible with an array in C programming language?

(A) Declaration

(B) Definition

(C) Dynamic Allocation

(D) Array of strings

Answer: Dynamic Allocation

24. Index of arrays in C programming language starts from?

(A) 0

(B) 1

(C) either 0 or 1

(D) undefined

Answer: 0

25. Arrays are best data structures

(A) for relatively permanent collections of data

(B) for the size of the structure and the data in the structure are constantly changing

(C) for both of above situation

(D) for non of above situation

Answer: for relatively permanent collections of data

26. A …………………… does not keep track of address of every element in the list.

(A) Stack

(B) String

(C) Linear array

(D) Queue

Answer: Linear array

27. Each array declaration need not give, implicitly or explicitly, the information about:

(A) the name of array

(B) the data type of array

(C) the first data from the set to be stored

(D) the index set of the array

Answer: the first data from the set to be stored

28. The memory address of the first element of an array is called:

(A) floor address

(B) foundation address

(C) first address

(D) base address

Answer: base address

29. Two dimensional arrays are also called:

(A) tables arrays

(B) matrix arrays

(C) both of above

(D) none of above

Answer: both of above

30. What is right way to Initialize array?

(A) int num[6] = { 2, 4, 12, 5, 45, 5 };

(B) int n{} = { 2, 4, 12, 5, 45, 5 };

(C) int n{6} = { 2, 4, 12 };

(D) int n(6) = { 2, 4, 12, 5, 45, 5 };

Answer: int num[6] = { 2, 4, 12, 5, 45, 5 }

31. An array elements are always stored in ________ memory locations.

(A) Sequential

(B) Random

(C) Sequential and Random

(D) None of the above

Answer: Sequential

32. Size of the array need not be specified, when:

(A) Initialization is a part of definition

(B) It is a declaratrion

(C) It is a formal parameter

(D) All of these

Answer: All of these

33. Array passed as an argument to a function is interpreted as:

(A) Address of the array.

(B) Values of the first elements of the array.

(C) Address of the first element of the array.

(D) Number of element of the array.

Answer: Address of the first element of the array

34. Which of the following correctly accesses the seventh element stored in arr, an array with 100 elements?

(A) arr[6]

(B) arr[7]

(C) arr{6}

(D) arr{7}

Answer: arr[6]

35. The smallest element of an array’s index is called its:

A. lower bound

B. upper bound

C. range

D. extraction

Answer: lower bound

Download the PDF File – Array MCQ Questions PDF



Categories: Abstract Data Types

%d bloggers like this: