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