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