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