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