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