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