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