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