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.

Difficile 10 questions ~8 minutes Réussi à partir de 80 % C17

Choisissez un mode

Vous jouez en invité : connectez-vous pour garder votre XP et votre série.

Exemple de question

Question 1 sur 10

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

Voir la réponse

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.

Ce que couvre ce 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

Questions fréquentes

Faut-il un compte ?

Non. Tout le monde peut jouer. Connectez-vous pour garder votre XP, votre série, vos badges et votre historique.

Puis-je le refaire ?

Oui. Votre meilleur score est conservé, et les questions comme les réponses sont mélangées à chaque fois.