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