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