Accenture Primer
Accenture DumpmediumAccenture PrimerAccenture-Primer-Dump

Which of the following declarations will cause a compile time error? a.int[] scores = null;

Answer options

A
int[] scores =new int[5];
B
String[] nameArray = new String[10];
C
String[] nameArray = (5,3,2);

Correct answer: String[] nameArray = (5,3,2);

Explanation

Option 2, 'String[] nameArray = (5,3,2);', causes a compile-time error because array initializers must use curly braces '{5,3,2}' not parentheses. Options 0 and 1 are valid array declarations. The question includes 'a. int[] scores = null;' in the stem as another valid option.

Related Accenture Accenture Primer questions

Practice more Accenture Accenture Primer questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.