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