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