🎙 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 7 of 10

Why does the product matrix need to be set to 0 before the multiplication loops?

Why does the product matrix need to be set to 0 before the multiplication loops?

  1. A.C requires every array to be zeroed
  2. B.Each c[i][j] is built with +=, so it must start from 0, not from garbage values
  3. C.So that printf prints aligned columns
  4. D.To make the loops run faster
Answer & explanation

Correct answer: Each c[i][j] is built with +=, so it must start from 0, not from garbage values

A local array is not initialised automatically; adding to garbage gives wrong results.

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 →