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