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