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