← 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?
- A.C requires every array to be zeroed
- B.Each c[i][j] is built with +=, so it must start from 0, not from garbage values
- C.So that printf prints aligned columns
- 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 →