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