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