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