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