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