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