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