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