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