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