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