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