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 does this code show? (Positions start at 0.)
let songs = ["Ocean", "Monsoon", "Rain"];
show(songs[2]); (a) Ocean (b) Rain (c) Monsoon - 2.True or false: notes to read offline fits saving on the phone. (a) False (b) True
- 3.True or false: your last game level fits saving on the phone. (a) False (b) True
-
4.💾 What number does this code show?
let notes = ["Music", "Science"];
notes.push("Sports");
show(notes.length); - 5.💾 Data saved only on the phone is lost when ___. (a) the screen turns off (b) you send a message (c) the phone is lost (d) the app is closed
- 6.Which of these fits saving on the phone? (a) a class leaderboard (b) a shared to-do list (c) chat messages to friends (d) notes to read offline
-
7.💾 What number does this code show?
let songs = ["Kites", "Ocean"];
songs.push("Monsoon");
show(songs.length); -
8.💾 What number does this code show?
let songs = ["Rain", "Sunrise"];
songs.push("Kites");
show(songs.length); -
9.💾 What number does this code show?
let points = 3;
points = points - 3;
points = points + 1;
show(points); -
10.💾 What does this code show? (Positions start at 0.)
let songs = ["Stars", "Ocean", "Kites", "Sunrise"];
show(songs[2]); (a) Sunrise (b) Stars (c) Kites (d) Ocean - 11.💾 Where should the app save a draft you are typing: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 12.True or false: a shared to-do list fits saving on the phone. (a) True (b) False
-
13.💾 What number does this code show?
let notes = ["Art", "Maths", "Hindi", "Sports"];
notes.push("Science");
notes.push("Music");
show(notes.length); -
14.💾 pop() takes off the last item. What does this code show?
let notes = ["Art", "Music", "Maths", "Science"];
notes.pop();
show(notes[notes.length - 1]); (a) Music (b) Science (c) Maths (d) Art - 15.💾 Where should the app save your last game level: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 16.💾 In most code, the first item of a list is at position ___. (a) 10 (b) 0 (c) 2 (d) 1
-
17.💾 What number does this code show?
let friends = ["Kabir", "Zoya", "Arjun"];
friends.push("Riya");
friends.push("Meera");
show(friends.length); -
18.💾 What does this code show? (Positions start at 0.)
let friends = ["Aman", "Meera", "Kabir"];
show(friends[1]); (a) Aman (b) Meera (c) Kabir -
19.💾 What number does this code show?
let friends = ["Riya", "Arjun", "Aman"];
friends.push("Kabir");
show(friends.length); - 20.💾 Where should the app save a shared to-do list: on the phone or in the cloud? (a) on the phone (b) in the cloud
-
21.💾 What number does this code show?
let score = 8;
score = score - 4;
score = score + 4;
show(score); -
22.💾 What number does this code show?
let notes = ["Maths", "Hindi", "Music", "Sports"];
notes.push("Art");
show(notes.length); -
23.💾 What number does this code show?
let coins = 5;
coins = coins - 1;
coins = coins + 1;
show(coins); - 24.💾 Where should the app save notes to read offline: on the phone or in the cloud? (a) on the phone (b) in the cloud
-
25.💾 pop() takes off the last item. What does this code show?
let notes = ["Maths", "Science", "Art", "Music"];
notes.pop();
show(notes[notes.length - 1]); (a) Music (b) Maths (c) Science (d) Art -
26.💾 What does this code show? (Positions start at 0.)
let songs = ["Kites", "Sunrise", "Monsoon"];
show(songs[0]); (a) Kites (b) Monsoon (c) Sunrise - 27.💾 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
- 28.💾 Which works with no internet at all? (a) a cloud leaderboard (b) a cloud backup (c) data saved on the phone (d) a shared chat
-
29.💾 What number does this code show?
let songs = ["Kites", "Stars", "Monsoon"];
songs.push("Sunrise");
show(songs.length); - 30.Which of these fits saving on the phone? (a) photos on two devices (b) a class leaderboard (c) chat messages to friends (d) a draft you are typing
- 31.💾 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
- 32.True or false: photos on two devices fits saving on the phone. (a) True (b) False
-
33.💾 What number does this code show?
let friends = ["Arjun", "Kabir"];
friends.push("Zoya");
show(friends.length); - 34.Which of these fits saving in the cloud? (a) notes to read offline (b) the sound on/off setting (c) a shared to-do list (d) your last game level
- 35.Which of these fits saving on the phone? (a) a shared to-do list (b) chat messages to friends (c) photos on two devices (d) the sound on/off setting
- 36.Which of these fits saving in the cloud? (a) photos on two devices (b) notes to read offline (c) your last game level (d) a draft you are typing
-
37.💾 What number does this code show?
let notes = ["Science", "Music", "Hindi"];
notes.push("Art");
show(notes.length); - 38.💾 Where should the app save chat messages to friends: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 39.True or false: the sound on/off setting fits saving on the phone. (a) True (b) False
- 40.True or false: chat messages to friends fits saving in the cloud. (a) True (b) False
Answer key
- Rain
- True
- True
- 3
- the phone is lost
- notes to read offline
- 3
- 3
- 1
- Kites
- on the phone
- False
- 6
- Maths
- on the phone
- 0
- 5
- Meera
- 4
- in the cloud
- 8
- 5
- 5
- on the phone
- Art
- Kites
- use it on any device
- data saved on the phone
- 4
- a draft you are typing
- on the phone
- False
- 3
- a shared to-do list
- the sound on/off setting
- photos on two devices
- 4
- in the cloud
- True
- True
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students