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