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