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

Quiz: C Output Questions · Question 9 of 10

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    char c = 'a' + 25;
    printf("%c %d\n", c, 'z' - 'a');
    return 0;
}
  1. A.a 25
  2. B.z 25
  3. C.z 26
  4. D.{ 25
Answer & explanation

Correct answer: z 25

Lowercase letters have consecutive codes, so 'a' + 25 is 'z' and 'z' - 'a' is 25.

Can you get the rest right without peeking?

Take the timed Quiz: C Output Questions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →