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