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