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