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