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