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