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