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