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