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