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