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