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