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