Java Programming
Accenture Technical PrimermediumJava Programming4. Arrays And Strings

Accenture Java Programming Practice Question

class Output { public static void main(String args[]) { int a1[] = new int[10]; int a2[] = {1, 2, 3, 4, 5}; System.out.println(a1.length + " " + a2.length); } }

Answer options

A
10 5
B
5 10
C
0 10
D
0 5 Array a1 is created so as to contain 10 integer elements. Hence, the length is 10. Array a2 is initialized with 5 values. . Hence, the length is 5. y g

Correct answer: 10 5

Explanation

Quick AnswerThe correct answer is 10 5 because it directly addresses the core logic of Java Programming.

Correct answer: 10 5.

Related Accenture Java Programming questions

Practice more Accenture Java Programming questions

PrimerPrep has 1400+ practice questions, 2026 simulations and coding hands-on — all free.

Watch Walkthroughs!