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