Data Structure Questions and Answers – Array and Array Operations
This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Array and Array Operations”.
1. Which of these best describes an array?
Explanation: Array contains elements only of the same type.
2. How do you initialize an array in C?
Explanation: This is the syntax to initialize an array in C.
3. How do you instantiate an array in Java?
Explanation: Note that int arr[]; is declaration whereas int arr[] = new int[3]; is to instantiate an array.
4. Which of the following is the correct way to declare a multidimensional array in Java?
Explanation: The syntax to declare multidimensional array in java is either int[][] arr; or int arr[][];
5. What is the output of the following Java code?
No comments:
Post a Comment