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