What is the result?

Given the code fragment:
<code>
int [] [] array2D = {{0, 1, 2}, {3, 4, 5, 6}};
system.out.print (array2D[0].length+ “” );
system.out.print(array2D[1].getClass(). isArray() + “”);
system.out.println (array2D[0][1]);
</code>
What is the result?

Given the code fragment:

int [] [] array2D = {{0, 1, 2}, {3, 4, 5, 6}};
system.out.print (array2D[0].length+ "" );
system.out.print(array2D[1].getClass(). isArray() + "");
system.out.println (array2D[0][1]);

What is the result?

A.
3false1

B.
2true3

C.
2false3

D.
3true1

E.
3false3

F.
2true1

G.
2false1

Explanation:

The length of the element with index 0, {0, 1, 2}, is 3. Output: 3
The element with index 1, {3, 4, 5, 6}, is of type array. Output: true
The element with index 0, {0, 1, 2} has the element with index 1: 1. Output: 1



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Carlos

Carlos

Don´t lose your time this exam don´t work, I lost the exam. my comments are deleted.

swamy

swamy

you mean none of the questions posted here showed up on the real exam??

Humberto

Humberto

You need to study.

sully

sully

These questions aren’t meant to be ones that will come up in the exam
they are just meant for backup learning not your main source.
If you get questions here like benefits of encapsulation? chance
that could come in the exam. But a piece of code wouldn’t.

If anyone’s interested i recommend the Mala Gupta book for learning

swamy

swamy

The length of the element with index 0, {0, 1, 2}, is 3. Output: 3
The element with index 1, {3, 4, 5, 6}, is of type array. Output: true
The element with index 0, {0, 1, 2} has the element with index 1: 1. Output: 1