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