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