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