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