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