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