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