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