Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Virtusa Written Test Qs.(JAVA Programming) :: Basic Concepts - Discussion

53 / 119

Choose the correct option.

class ArrayTest {
public static void main(String[] args) {
int[][] a1 = {{1,2,3},{4,5,6},{7,8,9,10}};
System.out.print(a1[0][2]+","+a1[1][0]+","+a1[2][1]);
}
}

APrints: 3, 4, 8

BPrints: 7, 2, 6

CRun-time error

DCompile-time error

Answer: Option (Login/Signup)

Show Explanation

In the given 2-dimensional array a1-

a1[0][2] = element in the first row and third column = 3

a1[1][0] = element in the second row and first column = 4

a1[2][1] = element in the third row and second column = 8

Hence, it prints 3,4,8.


Asked In :: Virtusa TCS NQT

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here