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

Answer key

  1. 3
  2. True
  3. 3
  4. on the phone
  5. Maths
  6. in the cloud
  7. on the phone
  8. in the cloud
  9. in the cloud
  10. Art
  11. False
  12. 4
  13. notes to read offline
  14. True
  15. 0
  16. Hindi
  17. Monsoon
  18. Music
  19. photos on two devices
  20. Rain
  21. the sound on/off setting
  22. 6
  23. 4
  24. 3
  25. True
  26. 4
  27. in the cloud
  28. 5
  29. the phone is lost
  30. True
  31. chat messages to friends
  32. a shared to-do list
  33. Art
  34. 5
  35. on the phone
  36. Kites
  37. False
  38. a list
  39. a draft you are typing
  40. Hindi

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