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