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