MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Based on the statement below, which of the following statements gives the length of the data array?double[ ] data = new double[10];
A
data.size()
B
data.length
C
data.size
D
data.length()
Explanation: 

Detailed explanation-1: -Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type i.e. 1. All elements of an array can be Integers.

Detailed explanation-2: -A two-dimensional array in java can be declared as follows: int[][] x = new int[10][20]; Therefore, the answer is d).

Detailed explanation-3: -Answer: C. int[][] blue = new int[2][2];

Detailed explanation-4: -To get the size of a Java array, you use the length property. To get the size of an ArrayList, you use the size() method. Know the difference between the Java array length and the String’s length() method.

There is 1 question to complete.