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