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