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