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