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