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