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