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