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