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