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