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