C Language Loop and Array Quiz

Quiz
•
Computers
•
University
•
Medium
Fidel Romasanta
Used 2+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
C-QUEST QUIZ BEE

Quiz
•
University
20 questions
Review JavaScript

Quiz
•
11th Grade - University
25 questions
Understanding Loops in Programming

Quiz
•
University
19 questions
Computer Science Quiz 02

Quiz
•
10th Grade - University
20 questions
Code Junction 4

Quiz
•
University
20 questions
PHP Quiz 1

Quiz
•
University
25 questions
Sharda fest 2024

Quiz
•
University
20 questions
EST102 : PROGRAMMING IN C TEST 1

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University