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