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