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