wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Prelim Computer Programming 2

Total questions: 40

Worksheet time: 40mins

Name
Class
Date
1.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A counter starts at 0 and moves to the next number.

(a)  

2.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

The total amount changes after adding today’s earnings.

(a)  

3.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A number stored in a variable is replaced with 100.

(a)  

4.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

Two quiz scores are checked to see if they match.

(a)  

5.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

The value in a wallet decreases after buying food

(a)  

6.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A worker earns the same pay each day for several days.

(a)  

7.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A class total is split evenly among groups.

(a)  

8.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A result changes after reversing a condition.

(a)  

9.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

Two requirements must both be satisfied before access is given.

(a)  

10.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

Access is allowed when at least one requirement is satisfied.

(a)  

11.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A player loses one life in a game.

(a)  

12.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A number is checked against another to see if it comes later in order.

(a)  

13.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

A score is checked to confirm it has not reached the limit yet.

(a)  

14.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

Items are shared and some are left over.

(a)  

15.

WRITE THE OPERATOR THAT SHOULD BE USED IN C++.

Two values are compared to confirm they are not the same.

(a)  

16.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch


Check if a number is positive or negative

(a)  

17.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch

  1. Determine letter grade: A (90+), B (80-89), C (70-79), D (60-69), F (below 60)



(a)  

18.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Process menu selection: 1=Start, 2=Load, 3=Save, 4=Exit



(a)  

19.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch

  1. Verify login: correct password → access, wrong → deny



(a)  

20.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch

  1. Check if temperature is above freezing (0°C)



(a)  

21.

Choose the BEST conditional structure.
I = if E = if-else EI = else if S = switch

  1. Identify day of week: Monday=1, Tuesday=2, ... Sunday=7



(a)  

22.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Calculate discount: Over $100=10%, $50-$100=5%, Under $50=0%



(a)  

23.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch

  1. Determine if a year is a leap year (yes/no)



(a)  

24.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch

  1. Check traffic light: Red=Stop, Yellow=Caution, Green=Go



(a)  

25.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Assign job risk level: Low (age<30), Medium (30-50), High (50+)



(a)  

26.

  1. Choose the BEST conditional structure.
    I = if E = if-else EI = else if S = switch

  2. Check if a user is an admin (single privilege check)



(a)  

27.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch

  1. Determine shipping method: Standard (3-5 days), Express (1-2 days), Overnight (next day)



(a)  

28.

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)  

29.

Choose the BEST conditional structure.
I = if E = if-else EI = else if S = switch

  1. Verify age for driving license: 16+ can drive, under 16 cannot



(a)  

30.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Categorize BMI: Underweight (<18.5), Normal (18.5-25), Overweight (25-30), Obese (>30)



(a)  

31.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Select ice cream flavor: Chocolate=1, Vanilla=2, Strawberry=3, Mint=4



(a)  

32.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Check if a file exists before opening it



(a)  

33.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Determine ticket type: VIP ($100), Premium ($75), Standard ($50), Economy ($25)



(a)  

34.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Identify blood type: A, B, AB, O (positive/negative separate)



(a)  

35.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Calculate tax bracket: 10% (<$10k), 12% ($10k-40k), 22% ($40k-85k), 24% ($85k+)



(a)  

36.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Check if a number is divisible by 3



(a)  

37.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Determine animal size: Small (<10kg), Medium (10-50kg), Large (50-100kg), XL (>100kg)



(a)  

38.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Process user role: Admin, Editor, Viewer, Guest (string values)



(a)  

39.

  1. Choose the BEST conditional structure.
    I = if E = else EI = else if S = switch

  2. Check if exam score is passing (≥60) or failing (<60)



(a)  

40.

Choose the BEST conditional structure.
I = if E = else EI = else if S = switch

  1. Identify season from month number: 12,1,2=Winter; 3,4,5=Spring; 6,7,8=Summer; 9,10,11=Fall



(a)