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