- Executores
-
Aprender
Aprender Python Exemplos executáveis, NumPy, pandas e mais Aprender IA / Machine LearningRedes neurais, ML e LLMs do zero Aprender C e C++ Ponteiros, memória, STL e C++ moderno Aprender C#Fundamentos, POO, LINQ, async e exercícios .NET Aprender MatplotlibGráficos de linha, barras, dispersão e pizza com visualizadores Aprender RustOwnership, traits, tratamento de erros e threads Aprender GoSlices, interfaces, goroutines e channels Algoritmos em Python Busca, ordenação, recursão e visualizações O(n) Algoritmos em C e C++ Compare implementações em C e C++ Programação para crianças Aprenda a programar brincando!
- QuizzesNovo
- DesafiosNovo
- Para professoresNovo
- Atualizações
- Me pague um café
Type Casting & Integer Promotion
This C quiz covers explicit casts and the implicit conversions C performs on its own, like integer promotion and the usual arithmetic conversions. You will predict results where the type of an expression changes the answer and spot the classic signed/unsigned trap.
Pergunta de exemplo
Pergunta 1 de 10What does this print?
#include <stdio.h>
int main(void) {
int a = 7, b = 2;
double r = (double)a / b;
printf("%.1f\n", r);
return 0;
}
Mostrar a resposta
A. 3.5 The cast applies to a before the division, so it is double / int, and b is converted to double too. The division keeps the fraction: 3.5.
O que este quiz cobre
- Casting
inttodoublebefore or after a division - Truncation when converting floating point to
int - Integer promotion of
charandshortin expressions - Comparing signed and unsigned values
- Overflow before widening
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.