Quiz de C: Arrays

This C quiz checks the basics of arrays - how they are declared and initialized, how indexing works and what happens when you pass one to a function. It is for beginners who have written a few loops and want to be sure about the rules.

Fácil 10 perguntas ~5 minutos Aprovação com 80% C17

Escolha um modo

Jogando como visitante: entre para guardar seu XP e sua sequência.

Pergunta de exemplo

Pergunta 1 de 10

What does this print?

#include <stdio.h>

int main(void) {
    int a[5] = {1, 2, 3};
    printf("%d %d\n", a[1], a[4]);
    return 0;
}
Mostrar a resposta

B. 2 0 Indexes start at 0, so a[1] is 2. When an initializer lists fewer values than the array holds, the remaining elements are set to 0, so a[4] is 0, not garbage.

O que este quiz cobre

  • Indexes from 0 to n - 1
  • Partial and designated initializers
  • Counting elements with sizeof(a) / sizeof(a[0])
  • Why arrays cannot be assigned with =
  • Arrays passed to functions share the caller's elements

Perguntas frequentes

Preciso de uma conta?

Não. Qualquer pessoa pode jogar. Entre para guardar seu XP, sequência, badges e histórico.

Posso refazer?

Pode. Sua melhor nota fica salva, e as perguntas e respostas são embaralhadas a cada vez.