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 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(14) → expected 100
Test 3: price(7) → expected 50 - 2.🧪 What is the actual result of a test? (a) the app’s name (b) the test’s number (c) what we hope for (d) what the app really does
-
3.🧪 What is the ACTUAL result of Test 2?
🚚 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(700) → expected 0
Test 2: delivery(450) → expected 40
Test 3: delivery(650) → expected 0 -
4.🧪 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(17) → expected 100
Test 2: price(18) → expected 100
Test 3: price(10) → expected 50 -
5.🧪 What is the ACTUAL result of Test 2?
🎟️ 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(12) → expected 100
Test 2: price(13) → expected 100
Test 3: price(9) → expected 50 - 6.🧪 A test fails when ___. (a) the font is big (b) the app is new (c) actual is not expected (d) both are the same
-
7.🧪 How many of these test cases pass?
🚚 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(1050) → expected 0 -
8.🧪 One test case fails. Which one?
🚚 Rule: delivery is free (0) when the order is 400 or more; otherwise it costs 40.
function delivery(total) {
if (total > 400) {
return 0;
}
return 40;
}
Test 1: delivery(400) → expected 0
Test 2: delivery(600) → expected 0
Test 3: delivery(250) → expected 40 (a) Test 1 (b) Test 2 (c) Test 3 -
9.🧪 How many of these test cases pass?
📝 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(5) → expected Try again
Test 2: result(6) → expected Pass
Test 3: result(7) → expected Pass -
10.🧪 One test case fails. Which one?
🎟️ 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(15) → expected 100
Test 3: price(12) → expected 100 (a) Test 1 (b) Test 3 (c) Test 2 -
11.🧪 What is the ACTUAL result of Test 2?
🚚 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(750) → expected 0
Test 2: delivery(450) → expected 40
Test 3: delivery(500) → expected 0 -
12.🧪 What is the ACTUAL result of Test 3?
🚚 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(950) → expected 0
Test 2: delivery(900) → expected 0
Test 3: delivery(500) → expected 40 -
13.🧪 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(15) → expected 100
Test 3: price(10) → expected 50 -
14.🧪 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(7) → expected Pass
Test 2: result(5) → expected Try again
Test 3: result(6) → expected Pass (a) Test 2 (b) Test 1 (c) Test 3 -
15.🧪 One test case fails. Which one?
📝 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(9) → expected Pass
Test 2: result(5) → expected Try again
Test 3: result(7) → expected Pass (a) Test 2 (b) Test 1 (c) Test 3 -
16.🧪 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(8) → expected 50
Test 2: price(12) → expected 100
Test 3: price(13) → expected 100 -
17.🧪 One test case fails. Which one?
🎟️ 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(9) → expected 100
Test 2: price(11) → expected 100
Test 3: price(8) → expected 50 (a) Test 1 (b) Test 2 (c) Test 3 -
18.🧪 What is the ACTUAL result of Test 2?
🎟️ 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(15) → expected 100
Test 3: price(13) → expected 50 -
19.🧪 One test case fails. Which one?
🚚 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(1000) → expected 0
Test 2: delivery(550) → expected 40
Test 3: delivery(700) → expected 0 (a) Test 2 (b) Test 3 (c) Test 1 -
20.🧪 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(10) → expected 100
Test 2: price(5) → expected 50
Test 3: price(8) → expected 100 (a) Test 1 (b) Test 3 (c) Test 2 -
21.🧪 One test case fails. Which one?
🚚 Rule: delivery is free (0) when the order is 400 or more; otherwise it costs 40.
function delivery(total) {
if (total > 400) {
return 0;
}
return 40;
}
Test 1: delivery(300) → expected 40
Test 2: delivery(400) → expected 0
Test 3: delivery(500) → expected 0 (a) Test 1 (b) Test 2 (c) Test 3 -
22.🧪 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(7) → expected Pass
Test 2: result(2) → expected Try again
Test 3: result(5) → expected Pass -
23.🧪 What is the ACTUAL result of Test 1?
🚚 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(450) → expected 40
Test 2: delivery(800) → expected 0
Test 3: delivery(650) → expected 0 -
24.🧪 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(7) → expected 50
Test 2: price(11) → expected 100
Test 3: price(16) → expected 100 (a) Test 3 (b) Test 1 (c) Test 2 -
25.🧪 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(18) → expected 100
Test 2: price(10) → expected 50
Test 3: price(19) → expected 100 -
26.🧪 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(500) → expected 0
Test 2: delivery(400) → expected 40
Test 3: delivery(700) → expected 0 -
27.🧪 How many of these test cases pass?
🎟️ 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(14) → expected 100
Test 3: price(15) → expected 100 -
28.🧪 One test case fails. Which one?
🎟️ 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(12) → expected 100
Test 2: price(11) → expected 50
Test 3: price(17) → expected 100 (a) Test 2 (b) Test 1 (c) Test 3 -
29.🧪 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(9) → expected Pass
Test 2: result(7) → expected Pass
Test 3: result(4) → expected Try again -
30.🧪 What is the ACTUAL result of Test 2?
🚚 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(650) → expected 0
Test 2: delivery(600) → expected 0
Test 3: delivery(400) → expected 40 -
31.🧪 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(12) → expected 100
Test 2: price(9) → expected 50
Test 3: price(14) → expected 100 -
32.🧪 How many of these test cases pass?
📝 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(3) → expected Try again
Test 2: result(9) → expected Pass
Test 3: result(7) → expected Pass -
33.🧪 One test case fails. Which one?
🎟️ 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(12) → expected 100
Test 2: price(9) → expected 50
Test 3: price(14) → expected 100 (a) Test 2 (b) Test 3 (c) Test 1 - 34.🧪 Values right at a limit, like age 12 for “under 12”, are called ___. (a) edge cases (b) old cases (c) phone cases (d) easy cases
-
35.🧪 What is the ACTUAL result of Test 1?
🚚 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(800) → expected 0
Test 2: delivery(650) → expected 0
Test 3: delivery(400) → expected 40 -
36.🧪 How many of these test cases pass?
🎟️ 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(12) → expected 100
Test 2: price(8) → expected 100
Test 3: price(5) → expected 50 -
37.🧪 What is the ACTUAL result of Test 3?
🚚 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(1250) → expected 0
Test 3: delivery(600) → expected 40 -
38.🧪 What is the ACTUAL result of Test 2?
🎟️ 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(19) → expected 100
Test 2: price(13) → expected 100
Test 3: price(12) → expected 50 -
39.🧪 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 -
40.🧪 How many of these test cases pass?
🎟️ 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(13) → expected 100
Test 3: price(7) → expected 50
Answer key
- 100
- what the app really does
- 40
- 100
- 100
- actual is not expected
- 3
- Test 1
- 3
- Test 3
- 40
- 40
- 100
- Test 3
- Test 3
- 50
- Test 1
- 100
- Test 3
- Test 3
- Test 2
- 2
- 40
- Test 2
- 100
- 3
- 3
- Test 1
- 3
- 0
- 2
- 3
- Test 1
- edge cases
- 0
- 2
- 40
- 50
- 2
- 3
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students