
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
Which loop type will always execute at least once, regardless of the condition?
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
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple

Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
15 questions
Quiz Pemrograman Arduino
Quiz
•
10th Grade - University
16 questions
Mảng 2 chiều trong C
Quiz
•
University
20 questions
Kelas 8 - Halaman 10 (UH Bab 1)
Quiz
•
8th Grade - University
20 questions
Revissão - Linguagem C (str, fun, stru, vt+mt,)
Quiz
•
University
20 questions
Data Structures and Algorithms
Quiz
•
University
15 questions
Code2Duo
Quiz
•
University
16 questions
Session 08: Array
Quiz
•
University
15 questions
MakeCode Arcade Questions
Quiz
•
10th Grade - University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
20 questions
ELA Advisory Review
Quiz
•
7th Grade
15 questions
Subtracting Integers
Quiz
•
7th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms
Quiz
•
11th Grade - University
38 questions
Unit 6 Key Terms
Quiz
•
11th Grade - University
20 questions
La Hora
Quiz
•
9th Grade - University
7 questions
Cell Transport
Interactive video
•
11th Grade - University
7 questions
What Is Narrative Writing?
Interactive video
•
4th Grade - University