
do while , for, Arrays
Quiz
•
Information Technology (IT)
•
University
•
Practice Problem
•
Medium
Fatma Metwally
Used 1+ times
FREE Resource
Enhance your content in a minute
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.
Access all questions and much more by creating a free account
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
Already have an account?
Similar Resources on Wayground
20 questions
7A-KIỂM TRA THƯỜNG XUYÊN 2
Quiz
•
7th Grade - University
20 questions
Advance Database Concepts (BSIT 3)
Quiz
•
University
18 questions
Python: operadores y tipos de datos
Quiz
•
University
15 questions
P3 IAS 2 Quiz
Quiz
•
University
11 questions
Keyboard Shortcuts
Quiz
•
5th Grade - University
20 questions
11-р анги
Quiz
•
11th Grade - University
12 questions
CLC Lesson 4&5 Quiz
Quiz
•
University
12 questions
Java_Quiz_Part_2
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
5 questions
Poetry Interpretation
Interactive video
•
4th Grade - University
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
15 questions
Review1
Quiz
•
University
15 questions
Pre1
Quiz
•
University
