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