App Dev Worksheet: Variables, Lists and Saving
Developer's tip (Box, list, place): A variable holds one value; a list holds many in order. Positions start at 0. push adds to the end; pop takes off the last item; length is how many items. On the phone: works offline, private. In the cloud: shared, any device, needs the internet.
NameDateTime takenScore ___ / 40
-
1.💾 What number does this code show?
let points = 5;
points = points - 2;
points = points + 3;
show(points); - 2.💾 Where should the app save the sound on/off setting: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 3.Which of these fits saving in the cloud? (a) photos on two devices (b) your last game level (c) notes to read offline (d) a draft you are typing
-
4.💾 What number does this code show?
let score = 6;
score = score - 1;
score = score + 5;
show(score); -
5.💾 What number does this code show?
let stars = 7;
stars = stars - 4;
stars = stars + 4;
show(stars); - 6.💾 Where should the app save notes to read offline: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 7.Which of these fits saving on the phone? (a) the sound on/off setting (b) chat messages to friends (c) photos on two devices (d) a class leaderboard
- 8.💾 Data saved only on the phone is lost when ___. (a) the phone is lost (b) the app is closed (c) the screen turns off (d) you send a message
- 9.Which of these fits saving on the phone? (a) chat messages to friends (b) a draft you are typing (c) a class leaderboard (d) a shared to-do list
- 10.💾 Saving data in the cloud lets you ___. (a) skip the internet (b) never need a password (c) shrink the app (d) use it on any device
- 11.True or false: the sound on/off setting fits saving on the phone. (a) False (b) True
- 12.True or false: a class leaderboard fits saving in the cloud. (a) True (b) False
- 13.True or false: a draft you are typing fits saving in the cloud. (a) False (b) True
-
14.💾 What does this code show? (Positions start at 0.)
let songs = ["Stars", "Monsoon", "Kites", "Rain", "Sunrise"];
show(songs[3]); (a) Kites (b) Stars (c) Monsoon (d) Rain -
15.💾 pop() takes off the last item. What does this code show?
let notes = ["Maths", "Music", "Hindi", "Art"];
notes.pop();
show(notes[notes.length - 1]); (a) Art (b) Hindi (c) Music (d) Maths - 16.💾 In most code, the first item of a list is at position ___. (a) 10 (b) 1 (c) 2 (d) 0
-
17.💾 pop() takes off the last item. What does this code show?
let notes = ["Science", "Sports", "Art", "Hindi", "Maths"];
notes.pop();
show(notes[notes.length - 1]); (a) Hindi (b) Sports (c) Science (d) Art -
18.💾 What number does this code show?
let songs = ["Ocean", "Rain"];
songs.push("Stars");
songs.push("Sunrise");
show(songs.length); -
19.💾 What number does this code show?
let notes = ["Music", "Science"];
notes.push("Art");
notes.push("Sports");
show(notes.length); -
20.💾 What does this code show? (Positions start at 0.)
let friends = ["Zoya", "Riya", "Aman", "Kabir", "Arjun"];
show(friends[0]); (a) Aman (b) Riya (c) Kabir (d) Zoya -
21.💾 What does this code show? (Positions start at 0.)
let songs = ["Monsoon", "Ocean", "Kites", "Stars"];
show(songs[0]); (a) Kites (b) Ocean (c) Stars (d) Monsoon - 22.True or false: photos on two devices fits saving in the cloud. (a) False (b) True
-
23.💾 What number does this code show?
let songs = ["Rain", "Ocean", "Kites", "Monsoon"];
songs.push("Stars");
songs.push("Sunrise");
show(songs.length); -
24.💾 What does this code show? (Positions start at 0.)
let friends = ["Riya", "Zoya", "Meera", "Arjun"];
show(friends[0]); (a) Zoya (b) Meera (c) Arjun (d) Riya -
25.💾 What number does this code show?
let coins = 5;
coins = coins - 2;
coins = coins + 5;
show(coins); -
26.💾 What number does this code show?
let lives = 9;
lives = lives - 2;
lives = lives + 2;
show(lives); - 27.True or false: a shared to-do list fits saving on the phone. (a) True (b) False
-
28.💾 What does this code show? (Positions start at 0.)
let notes = ["Art", "Hindi", "Sports", "Science", "Maths"];
show(notes[2]); (a) Art (b) Hindi (c) Science (d) Sports - 29.💾 Which can hold many values in order? (a) a single number (b) a button (c) a switch (d) a list
- 30.💾 Where should the app save chat messages to friends: on the phone or in the cloud? (a) in the cloud (b) on the phone
-
31.💾 What number does this code show?
let stars = 3;
stars = stars - 2;
stars = stars + 3;
show(stars); -
32.💾 What number does this code show?
let coins = 6;
coins = coins - 4;
coins = coins + 1;
show(coins); -
33.💾 pop() takes off the last item. What does this code show?
let friends = ["Aman", "Riya", "Kabir"];
friends.pop();
show(friends[friends.length - 1]); (a) Riya (b) Aman (c) Kabir - 34.Which of these fits saving on the phone? (a) a shared to-do list (b) a class leaderboard (c) notes to read offline (d) photos on two devices
-
35.💾 What number does this code show?
let friends = ["Arjun", "Kabir", "Aman"];
friends.push("Zoya");
friends.push("Meera");
show(friends.length); -
36.💾 What does this code show? (Positions start at 0.)
let songs = ["Monsoon", "Kites", "Sunrise"];
show(songs[2]); (a) Monsoon (b) Kites (c) Sunrise -
37.💾 pop() takes off the last item. What does this code show?
let notes = ["Art", "Maths", "Science"];
notes.pop();
show(notes[notes.length - 1]); (a) Maths (b) Science (c) Art - 38.Which of these fits saving on the phone? (a) photos on two devices (b) your last game level (c) a class leaderboard (d) chat messages to friends
-
39.💾 What does this code show? (Positions start at 0.)
let songs = ["Stars", "Kites", "Rain"];
show(songs[2]); (a) Kites (b) Rain (c) Stars -
40.💾 What number does this code show?
let score = 8;
score = score - 6;
score = score + 3;
show(score);
Answer key
- 6
- on the phone
- photos on two devices
- 10
- 7
- on the phone
- the sound on/off setting
- the phone is lost
- a draft you are typing
- use it on any device
- True
- True
- False
- Rain
- Hindi
- 0
- Hindi
- 4
- 4
- Zoya
- Monsoon
- True
- 6
- Riya
- 8
- 9
- False
- Sports
- a list
- in the cloud
- 4
- 3
- Riya
- notes to read offline
- 5
- Sunrise
- Maths
- your last game level
- Rain
- 5
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students