Tricky C Questions

These C questions look simple but hide a trap, from chained comparisons and integer promotion to octal literals and const pointers. The quiz is for experienced programmers preparing for interviews who want to explain not only what happens but why.

Schwer 10 Fragen ~8 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

According to the C standard, what is the value of 10 > 5 > 1?

Lösung zeigen

A. 0, because it means (10 > 5) > 1, which is 1 > 1 C has no chained comparisons: > groups left to right and gives 0 or 1, so 10 > 5 becomes 1 and 1 > 1 is 0. The trap is common enough that recent clang versions reject it by default; write 10 > 5 && 5 > 1 for the maths meaning.

Darum geht es in diesem Quiz

  • Chained comparisons and operator precedence with shifts
  • Integer promotion with ~ and float vs double comparisons
  • Unsigned loop counters and loops with an empty body
  • Octal literals, joined string literals and the type of 'a'
  • const int * vs int *const

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.