Квиз по C: if, switch & Loops

This C quiz checks how well you can follow the control flow of a program. You will trace if/else, switch with and without break, and for, while and do-while loops, and spot small bugs like a stray semicolon.

Лёгкий 10 вопроса ~5 минуты Проходной балл: 80% C17

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

#include <stdio.h>

int main(void) {
    int x = 2;
    switch (x) {
        case 1: printf("one ");
        case 2: printf("two ");
        case 3: printf("three");
            break;
        default: printf("other");
    }
    printf("\n");
    return 0;
}
Показать ответ

B. two three switch jumps to case 2 and then falls through into the following cases until it reaches a break. So it prints two and three, and the break stops it before default.

Что проверяет этот квиз

  • switch fall-through and break
  • for, while and do-while loops
  • break and continue
  • Which if an else belongs to
  • What counts as true in C

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.