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