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