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