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