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