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