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