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