App Dev Worksheet: Testing
Developer's tip (Expected vs actual): Test case = input + expected result (from the rule). Run the code: actual = expected → pass; otherwise → fail. Always test the edge value: < and <= differ only there.
NameDateTime takenScore ___ / 40
-
1.🧪 What is the ACTUAL result of Test 2?
🎟️ Rule: a ticket costs 50 for children under 10, and 100 for everyone else.
function price(age) {
if (age < 10) {
return 50;
}
return 100;
}
Test 1: price(8) → expected 50
Test 2: price(11) → expected 100
Test 3: price(10) → expected 100 -
2.🧪 How many of these test cases pass?
🎟️ Rule: a ticket costs 50 for children under 10, and 100 for everyone else.
function price(age) {
if (age < 10) {
return 50;
}
return 100;
}
Test 1: price(12) → expected 100
Test 2: price(14) → expected 100
Test 3: price(7) → expected 50 -
3.🧪 How many of these test cases pass?
🚚 Rule: delivery is free (0) when the order is 500 or more; otherwise it costs 40.
function delivery(total) {
if (total >= 500) {
return 0;
}
return 40;
}
Test 1: delivery(550) → expected 0
Test 2: delivery(350) → expected 40
Test 3: delivery(650) → expected 0 - 4.🧪 Values right at a limit, like age 12 for “under 12”, are called ___. (a) easy cases (b) phone cases (c) edge cases (d) old cases
- 5.🧪 A test fails when ___. (a) both are the same (b) the font is big (c) actual is not expected (d) the app is new
-
6.🧪 What is the ACTUAL result of Test 3?
🎟️ Rule: a ticket costs 50 for children under 8, and 100 for everyone else.
function price(age) {
if (age < 8) {
return 50;
}
return 100;
}
Test 1: price(13) → expected 100
Test 2: price(5) → expected 50
Test 3: price(14) → expected 100 -
7.🧪 One test case fails. Which one?
🎟️ Rule: a ticket costs 50 for children under 8, and 100 for everyone else.
function price(age) {
if (age <= 8) {
return 50;
}
return 100;
}
Test 1: price(8) → expected 100
Test 2: price(4) → expected 50
Test 3: price(9) → expected 100 (a) Test 2 (b) Test 1 (c) Test 3 -
8.🧪 What is the ACTUAL result of Test 1?
🚚 Rule: delivery is free (0) when the order is 300 or more; otherwise it costs 40.
function delivery(total) {
if (total >= 300) {
return 0;
}
return 40;
}
Test 1: delivery(400) → expected 0
Test 2: delivery(300) → expected 0
Test 3: delivery(250) → expected 40 -
9.🧪 What is the ACTUAL result of Test 1?
🎟️ Rule: a ticket costs 50 for children under 12, and 100 for everyone else.
function price(age) {
if (age < 12) {
return 50;
}
return 100;
}
Test 1: price(11) → expected 50
Test 2: price(14) → expected 100
Test 3: price(13) → expected 100 -
10.🧪 What is the ACTUAL result of Test 2?
🎟️ Rule: a ticket costs 50 for children under 8, and 100 for everyone else.
function price(age) {
if (age <= 8) {
return 50;
}
return 100;
}
Test 1: price(8) → expected 100
Test 2: price(9) → expected 100
Test 3: price(4) → expected 50 -
11.🧪 One test case fails. Which one?
📝 Rule: a quiz is passed with 6 or more right answers.
function result(right) {
if (right > 6) {
return "Pass";
}
return "Try again";
}
Test 1: result(6) → expected Pass
Test 2: result(7) → expected Pass
Test 3: result(4) → expected Try again (a) Test 3 (b) Test 2 (c) Test 1 -
12.🧪 What is the ACTUAL result of Test 3?
🎟️ Rule: a ticket costs 50 for children under 12, and 100 for everyone else.
function price(age) {
if (age < 12) {
return 50;
}
return 100;
}
Test 1: price(21) → expected 100
Test 2: price(18) → expected 100
Test 3: price(11) → expected 50 -
13.🧪 How many of these test cases pass?
🚚 Rule: delivery is free (0) when the order is 600 or more; otherwise it costs 40.
function delivery(total) {
if (total >= 600) {
return 0;
}
return 40;
}
Test 1: delivery(450) → expected 40
Test 2: delivery(650) → expected 0
Test 3: delivery(800) → expected 0 - 14.🧪 A test case is an input together with its ___. (a) screen colour (b) app icon (c) expected result (d) font size
-
15.🧪 What is the ACTUAL result of Test 1?
🎟️ Rule: a ticket costs 50 for children under 14, and 100 for everyone else.
function price(age) {
if (age <= 14) {
return 50;
}
return 100;
}
Test 1: price(10) → expected 50
Test 2: price(23) → expected 100
Test 3: price(20) → expected 100 -
16.🧪 What is the ACTUAL result of Test 3?
🚚 Rule: delivery is free (0) when the order is 300 or more; otherwise it costs 40.
function delivery(total) {
if (total > 300) {
return 0;
}
return 40;
}
Test 1: delivery(300) → expected 0
Test 2: delivery(250) → expected 40
Test 3: delivery(450) → expected 0 -
17.🧪 What is the ACTUAL result of Test 2?
🚚 Rule: delivery is free (0) when the order is 800 or more; otherwise it costs 40.
function delivery(total) {
if (total >= 800) {
return 0;
}
return 40;
}
Test 1: delivery(750) → expected 40
Test 2: delivery(1150) → expected 0
Test 3: delivery(1050) → expected 0 -
18.🧪 What is the ACTUAL result of Test 3?
🎟️ Rule: a ticket costs 50 for children under 13, and 100 for everyone else.
function price(age) {
if (age < 13) {
return 50;
}
return 100;
}
Test 1: price(11) → expected 50
Test 2: price(19) → expected 100
Test 3: price(17) → expected 100 - 19.🧪 Who else should try an app before release? (a) the app icon (b) only the coder (c) nobody (d) real users
-
20.🧪 What is the ACTUAL result of Test 1?
🎟️ Rule: a ticket costs 50 for children under 14, and 100 for everyone else.
function price(age) {
if (age <= 14) {
return 50;
}
return 100;
}
Test 1: price(16) → expected 100
Test 2: price(12) → expected 50
Test 3: price(18) → expected 100 -
21.🧪 How many of these test cases pass?
📝 Rule: a quiz is passed with 8 or more right answers.
function result(right) {
if (right >= 8) {
return "Pass";
}
return "Try again";
}
Test 1: result(11) → expected Pass
Test 2: result(10) → expected Pass
Test 3: result(5) → expected Try again -
22.🧪 What is the ACTUAL result of Test 1?
🚚 Rule: delivery is free (0) when the order is 700 or more; otherwise it costs 40.
function delivery(total) {
if (total >= 700) {
return 0;
}
return 40;
}
Test 1: delivery(550) → expected 40
Test 2: delivery(950) → expected 0
Test 3: delivery(850) → expected 0 -
23.🧪 What is the ACTUAL result of Test 1?
🚚 Rule: delivery is free (0) when the order is 600 or more; otherwise it costs 40.
function delivery(total) {
if (total >= 600) {
return 0;
}
return 40;
}
Test 1: delivery(500) → expected 40
Test 2: delivery(950) → expected 0
Test 3: delivery(900) → expected 0 -
24.🧪 How many of these test cases pass?
🎟️ Rule: a ticket costs 50 for children under 12, and 100 for everyone else.
function price(age) {
if (age < 12) {
return 50;
}
return 100;
}
Test 1: price(21) → expected 100
Test 2: price(18) → expected 100
Test 3: price(8) → expected 50 -
25.🧪 How many of these test cases pass?
📝 Rule: a quiz is passed with 7 or more right answers.
function result(right) {
if (right > 7) {
return "Pass";
}
return "Try again";
}
Test 1: result(5) → expected Try again
Test 2: result(7) → expected Pass
Test 3: result(8) → expected Pass -
26.🧪 How many of these test cases pass?
🚚 Rule: delivery is free (0) when the order is 300 or more; otherwise it costs 40.
function delivery(total) {
if (total >= 300) {
return 0;
}
return 40;
}
Test 1: delivery(500) → expected 0
Test 2: delivery(300) → expected 0
Test 3: delivery(200) → expected 40 -
27.🧪 One test case fails. Which one?
🎟️ Rule: a ticket costs 50 for children under 11, and 100 for everyone else.
function price(age) {
if (age <= 11) {
return 50;
}
return 100;
}
Test 1: price(17) → expected 100
Test 2: price(8) → expected 50
Test 3: price(11) → expected 100 (a) Test 2 (b) Test 3 (c) Test 1 -
28.🧪 What is the ACTUAL result of Test 3?
🎟️ Rule: a ticket costs 50 for children under 14, and 100 for everyone else.
function price(age) {
if (age <= 14) {
return 50;
}
return 100;
}
Test 1: price(14) → expected 100
Test 2: price(19) → expected 100
Test 3: price(12) → expected 50 -
29.🧪 What is the ACTUAL result of Test 3?
🎟️ Rule: a ticket costs 50 for children under 13, and 100 for everyone else.
function price(age) {
if (age <= 13) {
return 50;
}
return 100;
}
Test 1: price(16) → expected 100
Test 2: price(12) → expected 50
Test 3: price(13) → expected 100 -
30.🧪 One test case fails. Which one?
🎟️ Rule: a ticket costs 50 for children under 10, and 100 for everyone else.
function price(age) {
if (age <= 10) {
return 50;
}
return 100;
}
Test 1: price(10) → expected 100
Test 2: price(7) → expected 50
Test 3: price(11) → expected 100 (a) Test 2 (b) Test 3 (c) Test 1 -
31.🧪 One test case fails. Which one?
🎟️ Rule: a ticket costs 50 for children under 13, and 100 for everyone else.
function price(age) {
if (age <= 13) {
return 50;
}
return 100;
}
Test 1: price(13) → expected 100
Test 2: price(11) → expected 50
Test 3: price(18) → expected 100 (a) Test 2 (b) Test 1 (c) Test 3 - 32.🧪 What is the actual result of a test? (a) what the app really does (b) what we hope for (c) the app’s name (d) the test’s number
-
33.🧪 How many of these test cases pass?
📝 Rule: a quiz is passed with 5 or more right answers.
function result(right) {
if (right >= 5) {
return "Pass";
}
return "Try again";
}
Test 1: result(6) → expected Pass
Test 2: result(9) → expected Pass
Test 3: result(4) → expected Try again -
34.🧪 How many of these test cases pass?
📝 Rule: a quiz is passed with 5 or more right answers.
function result(right) {
if (right >= 5) {
return "Pass";
}
return "Try again";
}
Test 1: result(4) → expected Try again
Test 2: result(6) → expected Pass
Test 3: result(8) → expected Pass -
35.🧪 One test case fails. Which one?
📝 Rule: a quiz is passed with 5 or more right answers.
function result(right) {
if (right > 5) {
return "Pass";
}
return "Try again";
}
Test 1: result(5) → expected Pass
Test 2: result(3) → expected Try again
Test 3: result(6) → expected Pass (a) Test 2 (b) Test 1 (c) Test 3 -
36.🧪 One test case fails. Which one?
🎟️ Rule: a ticket costs 50 for children under 8, and 100 for everyone else.
function price(age) {
if (age <= 8) {
return 50;
}
return 100;
}
Test 1: price(8) → expected 100
Test 2: price(6) → expected 50
Test 3: price(13) → expected 100 (a) Test 3 (b) Test 1 (c) Test 2 -
37.🧪 What is the ACTUAL result of Test 2?
🚚 Rule: delivery is free (0) when the order is 700 or more; otherwise it costs 40.
function delivery(total) {
if (total > 700) {
return 0;
}
return 40;
}
Test 1: delivery(950) → expected 0
Test 2: delivery(600) → expected 40
Test 3: delivery(1000) → expected 0 -
38.🧪 What is the ACTUAL result of Test 1?
🚚 Rule: delivery is free (0) when the order is 800 or more; otherwise it costs 40.
function delivery(total) {
if (total > 800) {
return 0;
}
return 40;
}
Test 1: delivery(1100) → expected 0
Test 2: delivery(600) → expected 40
Test 3: delivery(800) → expected 0 -
39.🧪 How many of these test cases pass?
🎟️ Rule: a ticket costs 50 for children under 9, and 100 for everyone else.
function price(age) {
if (age < 9) {
return 50;
}
return 100;
}
Test 1: price(13) → expected 100
Test 2: price(10) → expected 100
Test 3: price(6) → expected 50 -
40.🧪 What is the ACTUAL result of Test 2?
🎟️ Rule: a ticket costs 50 for children under 11, and 100 for everyone else.
function price(age) {
if (age <= 11) {
return 50;
}
return 100;
}
Test 1: price(11) → expected 100
Test 2: price(8) → expected 50
Test 3: price(16) → expected 100
Answer key
- 100
- 3
- 3
- edge cases
- actual is not expected
- 100
- Test 1
- 0
- 50
- 100
- Test 1
- 50
- 3
- expected result
- 50
- 0
- 0
- 100
- real users
- 100
- 3
- 40
- 40
- 3
- 2
- 3
- Test 3
- 50
- 50
- Test 1
- Test 1
- what the app really does
- 3
- 3
- Test 1
- Test 1
- 40
- 0
- 3
- 50
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students