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