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