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