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