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