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