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