Data Structures MCQs ( Multiple Choice Questions ) - Array
Set - I
Q1. What is an array?
a) A data structure that shows a hierarchical behavior
b) Arrays are immutable once initialised
c) A Container of objects of similar types
d) Array is not a data structure
Q2. The smallest element of an array's index is called its
a) A lower bound.
b) upper bound.
c) range.
d) extraction
Q3. 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);
Q4.The extra key inserted at the end of the array is called a
a) End key.
b) Stop key.
c) Sentinel.
d) Transposition
Q5. 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;
Q6. The largest element of an array index is called its
a) Upper bound
b) range
c) Lower bound
d) All of these
Q7. 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
Q8. The elements of an array are stored successively in memory cells because
a) by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
b) the architecture of computer memory does not allow arrays to store other than serially
c) both of above
d) none of above
Q9. 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
Q10. What is the output of the following Java code?
public class array { public static void main(String args[]) { int []arr = {1,2,3,4,5}; System.out.println(arr[2]); System.out.println(arr[4]); } }
a) 3 and 5
b) 5 and 3
c) 2 and 4
d) 4 and 2
Q11. You want to find the nth element of a set of numbers. If you store the numbers in
a) Finding the nth element is slower if it was stored in an array
b) Finding the nth element is faster if it was stored in an array
c) Finding the nth element takes the same amount of time across all data structures
d) Finding the nth element is slower if it was stored in a hash table
Q12. 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. GATE CS 2008
a) Θ(n)
b) Θ(logn)
c) Θ(log*n)
d) Θ(1)
Q13. 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 none of above situation
Q14. When does the ArrayIndexOutOfBoundsException occur?
a) Compile-time
b) Run-time
c) Not an error
d) Not an exception at all
Q15. Two dimensional arrays are also called
a) tables arrays
b) matrix arrays
c) both of the above
d) none of the above
If you have any doubts join the discussion below ,our Moderator will reply to your Queries
Recommended MCQs
Java MCQs with Answers Set III
Informatica MCQs with Answers Set I
Informatica MCQs with Answers Set II
Informatica MCQs with Answers Set III
Informatica MCQs with Answers Set IV
Informatica MCQs with Answers Set V
Informatica MCQs with Answers Set VI
Computer Organization and Architecture MCQs with Answers Set I
Computer Organization and Architecture MCQs with Answers Set II
Computer Organization and Architecture MCQs with Answers Set III
If you have any doubts join the discussion below ,our Moderator will reply to your Queries