🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: String Handling in C: all 15 questions

Quiz: String Handling in C · Question 12 of 15

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int d, m, y;
    sscanf("21/11/2026", "%d/%d/%d", &d, &m, &y);
    printf("%d %d\n", m, y - 2000);
    return 0;
}
  1. A.21 26
  2. B.11 26
  3. C.11 2026
  4. D.0 0
Answer & explanation

Correct answer: 11 26

The / characters in the format must match the text, so the three numbers go into d, m and y.

Can you get the rest right without peeking?

Take the timed Quiz: String Handling in C quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →