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