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