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