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