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