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

Answer key

  1. 8
  2. 5
  3. 6
  4. a named box for a value
  5. in the cloud
  6. True
  7. True
  8. 5
  9. a draft you are typing
  10. Stars
  11. in the cloud
  12. a class leaderboard
  13. False
  14. False
  15. Arjun
  16. data saved on the phone
  17. False
  18. a list
  19. on the phone
  20. 4
  21. False
  22. 5
  23. True
  24. True
  25. False
  26. the sound on/off setting
  27. Sunrise
  28. Sunrise
  29. 8
  30. your last game level
  31. Arjun
  32. 0
  33. Riya
  34. 9
  35. 3
  36. 5
  37. 3
  38. Kabir
  39. Sports
  40. photos on two devices

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