C Language Loop and Array Quiz

C Language Loop and Array Quiz

University

22 Qs

quiz-placeholder

Similar activities

AI BootCamp: 2024 Edition- Session 1

AI BootCamp: 2024 Edition- Session 1

University

20 Qs

Pra UPS 2

Pra UPS 2

University

20 Qs

IGH Test de Entrada

IGH Test de Entrada

University

20 Qs

Relational Algebra and Calculus

Relational Algebra and Calculus

University

20 Qs

Artificial Intelligence CT-1

Artificial Intelligence CT-1

University

20 Qs

Micro Arch - CPUs & Fetch-Execute

Micro Arch - CPUs & Fetch-Execute

University

20 Qs

Cloud Review Quiz

Cloud Review Quiz

University

20 Qs

ECE522 QUIZ 2

ECE522 QUIZ 2

University

20 Qs

C Language Loop and Array Quiz

C Language Loop and Array Quiz

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Fidel Romasanta

Used 5+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct syntax for a for loop in C?

for (int i = 0; i < n; i++)

for int i = 0; i < n; i++

for (int i = 0; i < n)

for (int i = 0; i++)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when the condition in a do-while loop is initially false?

Infinite loop

The loop does not execute

Compilation error

The loop executes once

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the second statement in a for loop?

To initialize the loop variable

To specify the condition to continue the loop

To update the loop variable

To execute the loop body

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to skip the current iteration of a loop in C?

break

return

continue

goto

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if there is no update statement in a for loop?

The loop will not execute

Compilation error

The loop will execute infinitely if the condition is true

Undefined behavior

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following correctly initializes a loop variable and ensures it executes exactly 5 times?

for (int i = 0; i <= 5; i++)     

while (int i <= 5)

for (int i = 1; i <= 5; i++)

do { ... } while (i < 5)

7.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What will be the output of the following code?

    int i = 0;

    while (i < 5) {

        printf("%d ", i);

        i++;

    }

0 1 2 3 4

1 2 3 4 5

0 1 2 3 4 5

Infinite loop

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?