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