Multiple Choice Question

Quiz Guidelines

 

QID: 
228
Tags: 
Question: 

Which of the following code fragments will successfully initialize a two-dimensional array of chars named cA with a size such that cA[2][3] refers to a valid element?

1. char[][] cA = { { 'a', 'b', 'c' }, { 'a', 'b', 'c' } };
2. char cA[][] = new char[3][];
       for (int i=0; i<cA.length; i++) cA[i] = new char[4];
3.char cA[][] = { new char[ ]{ 'a', 'b', 'c' } , new char[ ]{   'a', 'b', 'c' } };
4char cA[3][2] = new char[][] { { 'a', 'b', 'c' }, { 'a', 'b','c' } };
5.char[][] cA = { "1234", "1234", "1234" };

Select 1 option

A. 1, 3
B. 4, 5
C. 2, 3
D. 1, 2, 3
E. 2

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!