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