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