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