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