C-Quiz: string.h Functions

This C quiz covers the everyday functions from string.h and stdio.h for working with text. You will predict their results and spot the mistakes that cause wrong comparisons, missing terminators and overflows.

Mittel 10 Fragen ~6 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>
#include <string.h>

int main(void) {
    printf("%zu\n", strlen("hello world"));
    return 0;
}
Lösung zeigen

C. 11 strlen counts every character before the terminator, including the space: 5 + 1 + 5 = 11. It does not count the '\0' itself, which is why 12 is wrong.

Darum geht es in diesem Quiz

  • Length, copy and append: strlen, strcpy, strcat
  • Comparing with strcmp instead of ==
  • Searching with strchr and strstr
  • Why strncpy may leave out the terminator
  • Safe formatting with snprintf

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.