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