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