🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Matrix Programs in C: all 10 questions

Quiz: Matrix Programs in C · Question 2 of 10

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int a[2][2] = {{1, 2}, {3, 4}};
    int b[2][2] = {{5, 6}, {7, 8}};
    int c = 0;
    for (int k = 0; k < 2; k++) c += a[1][k] * b[k][0];
    printf("%d\n", c);
    return 0;
}
  1. A.15
  2. B.22
  3. C.43
  4. D.50
Answer & explanation

Correct answer: 43

Row 1 of a (3, 4) times column 0 of b (5, 7): 3×5 + 4×7 = 15 + 28 = 43.

Can you get the rest right without peeking?

Take the timed Quiz: Matrix Programs in C quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →