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