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