🎙 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 8 of 15

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int d, m, y;
    int n = sscanf("15-08-1947", "%d-%d-%d", &d, &m, &y);
    printf("%d %d", n, m);
    return 0;
}
  1. A.1 8
  2. B.3 08
  3. C.3 8
  4. D.15 8
Answer & explanation

Correct answer: 3 8

sscanf fills all three ints and returns 3; m is 8 (printed with %d, so no leading zero).

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 →