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