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
Array and Array Operations MCQs and Answers
1. Which of these best describes an array?
2. How do you initialize an array in C?
3. How do you instantiate an array in Java?
4. Which of the following is the correct way to declare a multidimensional array in Java?
5. In general, the index of the first element in an array is __________
6. Elements in an array are accessed _____________
7. When does the ArrayIndexOutOfBoundsException occur?
8. Which of the following concepts make extensive use of arrays?
9. What are the advantages of arrays?
10. What are the disadvantages of arrays?
11. Assuming int is of 4 bytes, what is the size of int arr;?
12. In general, the index of the first element in an array is?
13. Elements in an array are accessed?
14. A mathematical-model with a collection of operations defined on that model is called:
15. The information about an array that is used in a program will be stored in:
16. Which of the following abstract data types can be used to represent a many to many relation?
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?
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?
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:
20. Which of the following is an illegal array definition?
21. Which of the following concepts make extensive use of arrays?
22. Which of the following operations is not O(1) for an array of sorted data. You may assume that array elements are distinct:
23. Which of the following is not possible with an array in C programming language?
24. Index of arrays in C programming language starts from?
25. Arrays are best data structures
26. A …………………… does not keep track of address of every element in the list.
27. Each array declaration need not give, implicitly or explicitly, the information about:
28. The memory address of the first element of an array is called:
29. Two dimensional arrays are also called:
30. What is right way to Initialize array?
31. An array elements are always stored in ________ memory locations.
32. Size of the array need not be specified, when:
33. Array passed as an argument to a function is interpreted as:
34. Which of the following correctly accesses the seventh element stored in arr, an array with 100 elements?
35. The smallest element of an array’s index is called its: