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