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