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 songs = ["Kites", "Rain", "Stars", "Sunrise"];
songs.pop();
show(songs[songs.length - 1]); (a) Sunrise (b) Kites (c) Rain (d) Stars - 2.💾 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
-
3.💾 What number does this code show?
let stars = 3;
stars = stars - 1;
stars = stars + 2;
show(stars); - 4.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) photos on two devices
-
5.💾 What number does this code show?
let notes = ["Art", "Sports", "Science", "Hindi"];
notes.push("Music");
notes.push("Maths");
show(notes.length); -
6.💾 What number does this code show?
let songs = ["Ocean", "Sunrise"];
songs.push("Kites");
show(songs.length); -
7.💾 What number does this code show?
let coins = 5;
coins = coins - 2;
coins = coins + 2;
show(coins); - 8.💾 Where should the app save notes to read offline: on the phone or in the cloud? (a) in the cloud (b) on the phone
- 9.True or false: your last game level fits saving in the cloud. (a) True (b) False
- 10.True or false: chat messages to friends fits saving in the cloud. (a) True (b) False
-
11.💾 pop() takes off the last item. What does this code show?
let songs = ["Sunrise", "Monsoon", "Ocean"];
songs.pop();
show(songs[songs.length - 1]); (a) Monsoon (b) Ocean (c) Sunrise - 12.True or false: a draft you are typing fits saving in the cloud. (a) True (b) False
- 13.True or false: a shared to-do list fits saving in the cloud. (a) True (b) False
- 14.Which of these fits saving in the cloud? (a) notes to read offline (b) a draft you are typing (c) a class leaderboard (d) the sound on/off setting
- 15.True or false: notes to read offline fits saving in the cloud. (a) True (b) False
-
16.💾 What number does this code show?
let songs = ["Ocean", "Stars"];
songs.push("Sunrise");
songs.push("Kites");
show(songs.length); - 17.Which of these fits saving in the cloud? (a) a draft you are typing (b) the sound on/off setting (c) notes to read offline (d) chat messages to friends
-
18.💾 What number does this code show?
let songs = ["Rain", "Monsoon", "Sunrise", "Kites"];
songs.push("Stars");
show(songs.length); - 19.💾 Where should the app save photos on two devices: 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: the sound on/off setting fits saving on the phone. (a) False (b) True
-
22.💾 What number does this code show?
let songs = ["Ocean", "Sunrise", "Monsoon"];
songs.push("Kites");
songs.push("Rain");
show(songs.length); -
23.💾 What does this code show? (Positions start at 0.)
let songs = ["Stars", "Kites", "Sunrise"];
show(songs[1]); (a) Sunrise (b) Kites (c) Stars -
24.💾 What number does this code show?
let notes = ["Science", "Music"];
notes.push("Sports");
show(notes.length); -
25.💾 What does this code show? (Positions start at 0.)
let songs = ["Monsoon", "Rain", "Stars", "Sunrise", "Kites"];
show(songs[4]); (a) Stars (b) Rain (c) Kites (d) Monsoon -
26.💾 What does this code show? (Positions start at 0.)
let notes = ["Music", "Maths", "Sports"];
show(notes[2]); (a) Maths (b) Music (c) Sports - 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 notes = ["Science", "Art"];
notes.push("Sports");
notes.push("Music");
show(notes.length); -
29.💾 pop() takes off the last item. What does this code show?
let friends = ["Kabir", "Zoya", "Meera", "Arjun", "Aman"];
friends.pop();
show(friends[friends.length - 1]); (a) Meera (b) Kabir (c) Zoya (d) Arjun -
30.💾 What number does this code show?
let notes = ["Hindi", "Science", "Maths", "Sports"];
notes.push("Art");
show(notes.length); - 31.Which of these fits saving on the phone? (a) your last game level (b) chat messages to friends (c) a class leaderboard (d) photos on two devices
- 32.Which of these fits saving on the phone? (a) chat messages to friends (b) photos on two devices (c) a shared to-do list (d) notes to read offline
- 33.Which of these fits saving in the cloud? (a) a shared to-do list (b) your last game level (c) a draft you are typing (d) the sound on/off setting
-
34.💾 What number does this code show?
let stars = 3;
stars = stars - 1;
stars = stars + 3;
show(stars); - 35.💾 Where should the app save chat messages to friends: on the phone or in the cloud? (a) on the phone (b) in the cloud
-
36.💾 What does this code show? (Positions start at 0.)
let notes = ["Science", "Music", "Sports"];
show(notes[2]); (a) Music (b) Sports (c) Science -
37.💾 pop() takes off the last item. What does this code show?
let notes = ["Science", "Hindi", "Music", "Maths", "Sports"];
notes.pop();
show(notes[notes.length - 1]); (a) Music (b) Hindi (c) Maths (d) Science - 38.True or false: the sound on/off setting fits saving in the cloud. (a) True (b) False
-
39.💾 What number does this code show?
let lives = 3;
lives = lives - 1;
lives = lives + 3;
show(lives); -
40.💾 What does this code show? (Positions start at 0.)
let songs = ["Stars", "Ocean", "Rain"];
show(songs[0]); (a) Ocean (b) Rain (c) Stars
Answer key
- Stars
- on the phone
- 4
- the sound on/off setting
- 6
- 3
- 5
- on the phone
- False
- True
- Monsoon
- False
- True
- a class leaderboard
- False
- 4
- chat messages to friends
- 5
- in the cloud
- on the phone
- True
- 5
- Kites
- 3
- Kites
- Sports
- on the phone
- 4
- Arjun
- 5
- your last game level
- notes to read offline
- a shared to-do list
- 5
- in the cloud
- Sports
- Maths
- False
- 5
- Stars
Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students