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