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