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