Which loop type will always execute at least once, regardless of the condition?

do while , for, Arrays

Quiz
•
Information Technology (IT)
•
University
•
Medium
Fatma Metwally
Used 1+ times
FREE Resource
16 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
do-while loop
while loop
for loop
foreach loop
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If a for loop has a condition i < 10, but inside the loop, we have a statement i += 3;, how many times will it run starting from i = 0?
6
4
3
5
Answer explanation
Starting from i = 0, the loop increments i by 3 each time: 0, 3, 6, 9. After that, i becomes 12, which is not less than 10. Thus, the loop runs 4 times before exiting.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly initializes a 2D array in C++ with all zeros?
int arr[3][3] = {};
int arr[3][3] = {0};
int arr[3][3] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };
All of the above
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which loop is most appropriate for iterating over elements when the number of iterations is known in advance?
do-while loop
while loop
for loop
foreach loop
5.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Which statement about arrays in C++ is true?
Array indices start at 1.
Arrays in C++ can store elements of different types.
Arrays in C++ store elements of the same type.
Array size must be specified at the time of declaration.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a 2D array declared as int matrix[3][3];, how do you access the element at the first row and second column?
matrix[0][1]
matrix[0][2]
matrix[2][1]
matrix[1][0]
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
100
20
90
40
Answer explanation
The loop accesses elements at indices 1 and 3 (arr[1] = 20, arr[3] = 40), so sum = 20 + 40 = 60.
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
Python Challenge

Quiz
•
University
20 questions
Pretest Alpro Dasar

Quiz
•
University
15 questions
DSA (QUIZ 7) -Greedy Algorithms and Complexity Analysis

Quiz
•
University
15 questions
Python Loop

Quiz
•
University
15 questions
Web Application - PHP Repetition

Quiz
•
University
15 questions
Python for loop/lists

Quiz
•
9th Grade - University
20 questions
Introduction to C# Programming

Quiz
•
10th Grade - University
18 questions
Arduino Quiz #11: Functions

Quiz
•
11th Grade - University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade