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