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