C-Quiz: printf & scanf

This C quiz tests the format strings of printf and scanf. You will predict formatted output with widths, precision and padding, pick the right conversion specifiers and learn why scanf needs addresses.

Leicht 10 Fragen ~5 Minuten Bestanden ab 80% C17

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 10

What does this print?

#include <stdio.h>

int main(void) {
    printf("%d + %d = %d\n", 2, 3, 2 + 3);
    return 0;
}
Lösung zeigen

C. 2 + 3 = 5 Each %d is replaced by the next argument in order: 2, 3 and the value of 2 + 3, which is 5. The expression is evaluated before printf sees it.

Darum geht es in diesem Quiz

  • Conversion specifiers like %d, %f, %x, %c and %s
  • Width, precision, zero padding and left alignment
  • Printing a literal %
  • Why scanf takes &variable and what it returns
  • %lf in scanf vs %f in printf

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.