WorksheetsPrelim Computer Programming 2
Total questions: 40
Worksheet time: 40mins
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A counter starts at 0 and moves to the next number.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
The total amount changes after adding today’s earnings.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A number stored in a variable is replaced with 100.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
Two quiz scores are checked to see if they match.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
The value in a wallet decreases after buying food
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A worker earns the same pay each day for several days.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A class total is split evenly among groups.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A result changes after reversing a condition.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
Two requirements must both be satisfied before access is given.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
Access is allowed when at least one requirement is satisfied.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A player loses one life in a game.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A number is checked against another to see if it comes later in order.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
A score is checked to confirm it has not reached the limit yet.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
Items are shared and some are left over.
(a)
WRITE THE OPERATOR THAT SHOULD BE USED IN C++.
Two values are compared to confirm they are not the same.
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Check if a number is positive or negative
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Determine letter grade: A (90+), B (80-89), C (70-79), D (60-69), F (below 60)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchProcess menu selection: 1=Start, 2=Load, 3=Save, 4=Exit
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Verify login: correct password → access, wrong → deny
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Check if temperature is above freezing (0°C)
(a)
Choose the BEST conditional structure.
I = if E = if-else EI = else if S = switch
Identify day of week: Monday=1, Tuesday=2, ... Sunday=7
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchCalculate discount: Over $100=10%, $50-$100=5%, Under $50=0%
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Determine if a year is a leap year (yes/no)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Check traffic light: Red=Stop, Yellow=Caution, Green=Go
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchAssign job risk level: Low (age<30), Medium (30-50), High (50+)
(a)
Choose the BEST conditional structure.
I = if E = if-else EI = else if S = switchCheck if a user is an admin (single privilege check)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Determine shipping method: Standard (3-5 days), Express (1-2 days), Overnight (next day)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Process payment type: Credit Card (CC), Debit Card (DC), PayPal (PP), Cash (CA)
(a)
Choose the BEST conditional structure.
I = if E = if-else EI = else if S = switch
Verify age for driving license: 16+ can drive, under 16 cannot
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchCategorize BMI: Underweight (<18.5), Normal (18.5-25), Overweight (25-30), Obese (>30)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchSelect ice cream flavor: Chocolate=1, Vanilla=2, Strawberry=3, Mint=4
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchCheck if a file exists before opening it
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchDetermine ticket type: VIP ($100), Premium ($75), Standard ($50), Economy ($25)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchIdentify blood type: A, B, AB, O (positive/negative separate)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchCalculate tax bracket: 10% (<$10k), 12% ($10k-40k), 22% ($40k-85k), 24% ($85k+)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchCheck if a number is divisible by 3
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchDetermine animal size: Small (<10kg), Medium (10-50kg), Large (50-100kg), XL (>100kg)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchProcess user role: Admin, Editor, Viewer, Guest (string values)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switchCheck if exam score is passing (≥60) or failing (<60)
(a)
Choose the BEST conditional structure.
I = if E = else EI = else if S = switch
Identify season from month number: 12,1,2=Winter; 3,4,5=Spring; 6,7,8=Summer; 9,10,11=Fall
(a)
