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