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