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