Multiple choice

What will be the output of array variable table after executing the following code? include<iostream.h> int main() { for(int j=0;j<3;j++) { for(int k=0;k<3;k++) { if(k==j)
table[j][k]=1; else table[j][k]=0; } } for(int i=0;i<3;i++) { for(int l=0;l<3;l++) { cout<<table[i][l] ; } cout<<endl; } return 0; }

  1. 1 0 01 1 01 1 1

  2. 0 0 10 1 01 0 0

  3. 1 0 00 1 00 0 1

  4. 0 0 00 0 00 0 0

  5. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

If we trace the program as follows: j=0 j=1 j=2k=0 k=0 k=0k==j k.