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