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