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