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