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