Skills101
← All practice quizzes

Quiz: C Output Questions

5 questionsNo time limitPass: 60%+10 XP on first pass

The tricky C snippets used in TCS, Infosys, Wipro and Capgemini pseudocode and technical rounds — operators, loops, pointers, strings, macros and static — each run and explained.

Log in to take the quiz

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

  1. Question 1

    What does this print?

    #include <stdio.h>
    int main(void) {
        int a = 5;
        int b = a++ + 10;
        printf("%d %d", a, b);
        return 0;
    }
    
  2. Question 2

    What does this print?

    #include <stdio.h>
    int main(void) {
        int i = 1;
        if (i-- && i++) printf("A");
        printf("%d", i);
        return 0;
    }
    
  3. Question 3

    What does this print?

    #include <stdio.h>
    int main(void) {
        int arr[] = {1, 2, 3, 4, 5};
        int *p = arr;
        printf("%d", *(p + 3) - *p);
        return 0;
    }
    
  4. Question 4

    What does this print?

    #include <stdio.h>
    #define SQ(x) x * x
    int main(void) {
        printf("%d", SQ(4 - 1));
        return 0;
    }
    
  5. Question 5

    What does this print?

    #include <stdio.h>
    int main(void) {
        int x = 10;
        printf("%d", x / 4 * 4 + x % 4);
        return 0;
    }