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

Answer key

  1. 3
  2. a named box for a value
  3. Riya
  4. chat messages to friends
  5. False
  6. 7
  7. Music
  8. False
  9. a list
  10. on the phone
  11. 5
  12. True
  13. 4
  14. the phone is lost
  15. 5
  16. True
  17. data saved on the phone
  18. Stars
  19. Sunrise
  20. 3
  21. False
  22. Hindi
  23. True
  24. in the cloud
  25. in the cloud
  26. photos on two devices
  27. 0
  28. in the cloud
  29. 2
  30. on the phone
  31. False
  32. Riya
  33. a draft you are typing
  34. 6
  35. on the phone
  36. True
  37. on the phone
  38. in the cloud
  39. Maths
  40. a shared to-do list

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