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