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