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