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