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