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