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