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