
conditional statements and While Loop

Quiz
•
Information Technology (IT)
•
University
•
Hard
Fatma Metwally
Used 5+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code if int x = 5?
Greater than 10
10 or less
No output
Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is wrong with the following code?
Missing a semicolon
The if condition is missing parentheses
== should be =
Nothing, the code is correct
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
You want to assign a discount based on a customer’s age:
Age 0-12: "Child discount"
Age 13-18: "Teen discount"
Age 19-64: "Adult discount"
Age 65 and above: "Senior discount"
Which type of control structure is best suited for this scenario?
if
if-else if
switch
while
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following code, what would be the output if grade = 85;?
A
B
C
D
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code if int x = 5;?
Equal to 10
Not equal to 10
No output
Compilation error
Answer explanation
The condition mistakenly uses = for assignment instead of == for comparison, so x = 10 makes x equal to 10, which is non-zero (true), and the if block executes.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code print if int grade = 75;?
Excellent Done
Good Done
Good
Average Done
Answer explanation
grade is 75, so grade > 70 is true, which makes "Good" print. The final cout << " Done"; is outside the conditions, so "Done" is also printed.
7.
OPEN ENDED QUESTION
3 mins • 1 pt
Write a program that checks if a number is positive, negative, or zero. Display appropriate messages for each case.
Evaluate responses using AI:
OFF
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
ICT BEL 4

Quiz
•
4th Grade - University
10 questions
Aptitude_Ages

Quiz
•
University
16 questions
Kuis Uji Pemahaman Python Variabel, Sintaks Dasar, Type Data

Quiz
•
11th Grade - University
10 questions
Quiz on Basics of C

Quiz
•
University
11 questions
CodeQuest TechTopia 2025-26

Quiz
•
University
8 questions
Intro to JS: Variables & Values

Quiz
•
11th Grade - University
15 questions
MakeCode Arcade Questions

Quiz
•
10th Grade - University
15 questions
Understanding Loops in C Programming

Quiz
•
1st Grade - University
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
10 questions
"LAST STOP ON MARKET STREET" Vocabulary Quiz

Quiz
•
3rd Grade
19 questions
Fractions to Decimals and Decimals to Fractions

Quiz
•
6th Grade
16 questions
Logic and Venn Diagrams

Quiz
•
12th Grade
15 questions
Compare and Order Decimals

Quiz
•
4th - 5th Grade
20 questions
Simplifying Fractions

Quiz
•
6th Grade
20 questions
Multiplication facts 1-12

Quiz
•
2nd - 3rd Grade