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