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