Java arrays

👁 19
statistics
by Dr. Osama M. Khaled last modified 2022-07-19T05:23:41+01:00

Array is an important structure in programming language and Java programming language no difference

Questions #: 4
Time:
Pass Score: 80.0%
Style
Mode

Is the following array defined as null or with 0 length?

int temp_array[];

POINTS (1)

Correct Answer

Explanation


What is the correct array initialization from the following?

POINTS (1)

Correct Answer

Explanation


Is the following code correct?

Verify the following code and check if there is something wrong
public class MyClass {
  public static void main(String[] args) {
    int[] myNumbers = {"1", "2", "3", "4"};
    for (int i = 0; i < myNumbers.length; ++i) {
        System.out.println(myNumbers[i]);
    }
  }
}
POINTS (1)

Correct Answer

Explanation


What is the the output of the following code snippet?

public class MyClass {
  public static void main(String[] args) {
    int[] myNumbers = {1, 2, 3, 4};
    System.out.println(myNumbers[1])
  }
}
Missing
POINTS (1)

Correct Answer

Explanation


Views:
Trials:
Avg score: