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