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