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

Answer key

  1. a list
  2. Maths
  3. 0
  4. False
  5. True
  6. 4
  7. Sports
  8. False
  9. 4
  10. a shared to-do list
  11. True
  12. a draft you are typing
  13. on the phone
  14. a class leaderboard
  15. False
  16. Rain
  17. notes to read offline
  18. Kites
  19. Kabir
  20. your last game level
  21. in the cloud
  22. Sunrise
  23. Rain
  24. True
  25. a named box for a value
  26. 5
  27. Riya
  28. False
  29. in the cloud
  30. Rain
  31. Hindi
  32. Zoya
  33. 10
  34. on the phone
  35. True
  36. Kabir
  37. 5
  38. False
  39. in the cloud
  40. Science

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