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