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