Assignment of objective questions
1. An array is a collection of...
a. Values
b. Variables
c. Constants
d. Operators
Answer - a. Values
2. An array is a collection of...
a. Similar kinds of data elements.
b. Dissimilar kinds of data elements.
c. Unique kinds of data elements.
d. Irregular kinds of data elements.
Answer - a. Similar kinds of data elements.
3. Array element stored at?
a. Continuous memory location
b. Discontinuous memory location
c. Stack memory location
d. Heap memory location
Answer - a. Continuous memory location
4. Which is the correct syntax of declaring an Array?
a. <data_type> <array_name> <size>
b. <data_type> <array_name> <size>;
c. <data_type> <array_name> [<size>]
d. <data_type> <array_name> [<size>];
Answer - d. <data_type> <array_name> [<size>];
5. "[/]" in Arrays is also known as...
a. Method Resolution Operator
b. Subscript Operator
c. Index Operator
d. Access Operator
Answer - b. Subscript Operator
6. Size in the declaration of the array indicates that...
a. Number of values an array can hold.
b. Types of values an array can hold.
c. Highest Digits of values an array can hold.
d. Compulsory, otherwise SYNTAX ERROR!
Answer - a. Number of values an array can hold.
7. Every Logical Block of an Array is also known as...
a. Memory Sector
b. Memory Area
c. Memory Block
d. Memory Cell
Answer - d. Memory Cell
8. Indexing of an Array always starts from...
a. 1
b. 0
c. Compiler Dependent Behavior
d. From where the programmer wants
Answer - b. 0
9. Which of the following is the correct syntax of initializing the cell of the array?
a. <array> = <value>
b. <array> = <value>;
c. <array> <index> = <value>;
d. <array> [<index>] = <value>;
Answer - d. <array> [index] = <value>;
10. The last index of an Array is...
a. size of the Array.
b. size - 1 of the Array.
c. size * size of the data type of the Array.
d. size/size of the data type of the Array.
Answer - b. size - 1 of the Array.
11. If the loop on the array is iterated more than the size of the array then What
will happen?
a. Will run successfully.
b. Unpredictable.
c. Depends on the compiler.
d. Depends on the Platform (Operating System and CPU).
Answer - b. Unpredictable.
12. Can we give a variable as the size of an array at the time of array declaration?
a. Yes
b. No
c. Only available in Compilers other than Turbo.
d. Only available in Turbo Compiler.
Answer - c. Only available in Compilers other than Turbo.
13. The size given to an array while declaring must be...
a. An Integer Constant
b. Character Constant
c. Float Constant
d. Double Constant
Answer - a. An Integer Constant
14. The size of an array can be blank?
a. Yes, it can dynamically grow or shrink.
b. Yes, in Modern compiler
c. Yes, in Turbo compiler
d. Yes, with initializers list otherwise ERROR!
Answer - d. Yes, with initializers list otherwise ERROR!
15. The minimum size of an array will be...
a. 0
b. 1
c. 5
d. Compiler Dependent Behavior
Answer - b. 1
16. The maximum size of an array in Turbo Compiler is...
a. 65535
b. 65536
c. 32767
d. 32768
Answer - c. 32767
17. Which of the following is a correct syntax of initializing array using
initializers?
a. <data_type> <array_name> <size> = {<value>, <value>, ...};
b. <data_type> <array_name> [<size>] = {<value>; <value>; ...};
c. <data_type> <array_name> [<size>] = {<value>, <value>, ...}
d. <data_type> <array_name> [<size>] = {<value>, <value>, ...};
Answer - d. <data_type> <array_name> [<size>] = {<value>, <value>, ...};
18. Is the following expression is valid?
int months [12];
months = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
a. Yes
b. No
c. Error
d. Compiler dependent behavior
Answer - c. Error
19. Is the following expression is valid?
int months [12] = {31, 28, 31, 30, 31, 30, 31};
a. Yes
b. No
c. Error
d. Compiler dependent behavior
Answer - a. Yes
20. Is the following expression is valid?
int months [12] = {31, , 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
a. Yes
b. No
c. Error
d. Compiler dependent behavior
Answer - c. Error