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