Skills101
← All practice quizzes

Quiz: Matrix Programs in C

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

The matrix programs from every C lab list and many coding rounds, explained step by step. Reading and printing a matrix, addition, transpose, row and column totals, multiplication with the rule for sizes, diagonals and the symmetric check, and printing in spiral order.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    A matrix A is 2 × 3 and B is 3 × 4. What is the size of A × B?

  2. Question 2

    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;
    }
    
  3. Question 3

    What is the transpose of a matrix?

  4. Question 4

    To add up one student's marks in marks[3][4] (students in rows), which index stays fixed?

  5. Question 5

    What does this print?

    #include <stdio.h>
    int main(void) {
        int m[3][3] = {{4, 1, 2}, {6, 5, 3}, {9, 8, 7}};
        int d1 = 0, d2 = 0;
        for (int i = 0; i < 3; i++) { d1 += m[i][i]; d2 += m[i][2 - i]; }
        printf("%d %d\n", d1, d2);
        return 0;
    }
    
🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →