💩

programierds

Tests
C Beginner 10 min

While structure in C

Test to learn how the while loop works in C.

questions

20

Tiempo estimado

10:00:00

Avance: 0%

C Beginner 10 min 20 preguntas

While structure in C

Test to learn how the while loop works in C.

Pregunta 1

What is the while loop used for in C?

Opciones para What is the while loop used for in C?

Pregunta 2

What does this program print?

Snippet c
int i = 1;

while(i <= 3){
    printf("%d ", i);
    i++;
}
Opciones para What does this program print?

Pregunta 3

What happens if the while condition is always true?

Opciones para What happens if the while condition is always true?

Pregunta 4

What does this code print?

Snippet c
int i = 0;

while(i < 3){
    printf("%d ", i);
    i++;
}
Opciones para What does this code print?

Pregunta 5

Which is the correct syntax for a while loop?

Opciones para Which is the correct syntax for a while loop?

Pregunta 6

What does this code print?

Snippet c
int i = 5;

while(i > 0){
    printf("%d ", i);
    i--;
}
Opciones para What does this code print?

Pregunta 7

Which part of the while loop controls how many times it repeats?

Opciones para Which part of the while loop controls how many times it repeats?

Pregunta 8

What does this program print?

Snippet c
int i = 1;

while(i <= 5){
    printf("Hi ");
    i++;
}
Opciones para What does this program print?

Pregunta 9

What happens if you forget to update the loop variable inside the while?

Opciones para What happens if you forget to update the loop variable inside the while?

Pregunta 10

What does this code print?

Snippet c
int i = 1;
int sum = 0;

while(i <= 3){
    sum += i;
    i++;
}

printf("%d", sum);
Opciones para What does this code print?

Pregunta 11

When is the while condition evaluated?

Opciones para When is the while condition evaluated?

Pregunta 12

What does this program print?

Snippet c
int i = 2;

while(i <= 6){
    printf("%d ", i);
    i += 2;
}
Opciones para What does this program print?

Pregunta 13

What does this code do?

Snippet c
int i = 0;

while(i < 3){
    printf("C ");
    i++;
}
Opciones para What does this code do?

Pregunta 14

What does this code print?

Snippet c
int i = 3;

while(i > 3){
    printf("%d", i);
}
Opciones para What does this code print?

Pregunta 15

What does this program print?

Snippet c
int i = 1;

while(i < 4){
    printf("%d ", i);
    i++;
}
Opciones para What does this program print?

Pregunta 16

What is the point of incrementing the loop variable?

Opciones para What is the point of incrementing the loop variable?

Pregunta 17

What does this code print?

Snippet c
int i = 1;

while(i <= 4){
    printf("%d ", i*2);
    i++;
}
Opciones para What does this code print?

Pregunta 18

What does this program print?

Snippet c
int i = 0;

while(i < 3){
    printf("%d ", i);
    i++;
}
Opciones para What does this program print?

Pregunta 19

What does this code print?

Snippet c
int i = 3;

while(i > 0){
    printf("%d ", i);
    i--;
}
Opciones para What does this code print?

Pregunta 20

Which is a good practice when using while?

Opciones para Which is a good practice when using while?

Elegi una opcion por pregunta y despues hace click en Revisar resultados.