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