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