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