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