← Data: variables, lists and saving lesson New set →

App Dev Worksheet: Variables, Lists and Saving

App development lesson 15: Data: variables, lists and saving · Set 987 · 40 questions
TalentJR

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

Answer key

  1. 6
  2. 5
  3. False
  4. a list
  5. Riya
  6. Maths
  7. a draft you are typing
  8. Meera
  9. 4
  10. Science
  11. Aman
  12. 4
  13. photos on two devices
  14. Meera
  15. your last game level
  16. True
  17. 4
  18. 6
  19. Riya
  20. on the phone
  21. a shared to-do list
  22. in the cloud
  23. use it on any device
  24. Riya
  25. Zoya
  26. False
  27. 6
  28. True
  29. Kites
  30. on the phone
  31. 3
  32. True
  33. False
  34. 0
  35. a class leaderboard
  36. Science
  37. the sound on/off setting
  38. 4
  39. True
  40. 8

Free app development lessons, practice and worksheets at talentjr.in/app-development-for-students