[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

JAVA Programming :: Basic Concepts - Discussion

Home > JAVA Programming > Basic Concepts > MCQs Questions Discussion

8 / 64

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

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