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