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