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