CSC126_Chapter4_Part1

Quiz
•
Computers
•
University
•
Medium
TS ZAKARIA
Used 3+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Discover the problem of the following line of codes:
for (int i = 1; i<=2; ++i)
The loop condition i=<2 should be i<=2
The semicolons should be changed to commas.
The update statement ++i should be changed to i++
There should be a semicolon at the end of the for statement.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following for loop causes an infinite loop?
for (int i=0; i<10; i--)
{
cout << i;
}
for (int i=0; i<10; i+=2)
{
cout << i;
}
for (int i=10; i>0; i--)
{
cout << i;
}
for (int i=0; i>10; i+=2)
{
cout << i;
}
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main purpose of a repetition structure?
To store data in a specific order
To execute a single instruction
To repeat one or more instructions until a condition is met
To control user input
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a basic type of repetition structure in C++?
for loop
while loop
switch loop
do…while loop
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a Loop Control Variable (LCV)?
A function to print output
A variable that controls the flow of the program
A component to read user input
A syntax for conditional looping
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Where is the LCV placed in a for loop statement?
Inside the function block
In the parameters of the for loop (initialization, condition, update)
Outside the main function
Only inside void functions
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times will the following code print *?
for(int i=1; i<=3; i++) cout << "*";
2
3
4
0
Create a free account and access millions of resources
Similar Resources on Wayground
12 questions
Array

Quiz
•
University
10 questions
Lec04 - Quiz03: Video and Audio players

Quiz
•
University
10 questions
Struktur Data

Quiz
•
University
10 questions
Java Control Flow statements

Quiz
•
University
12 questions
javaquizvivek

Quiz
•
University
10 questions
PHP Basics

Quiz
•
University
15 questions
quiz pertemuan 2 asik ddp

Quiz
•
University
12 questions
Divide et Impera

Quiz
•
11th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
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
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University