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