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