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