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