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