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