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

Answer key

  1. Riya
  2. notes to read offline
  3. in the cloud
  4. the phone is lost
  5. False
  6. False
  7. 4
  8. False
  9. False
  10. Meera
  11. in the cloud
  12. on the phone
  13. False
  14. Science
  15. False
  16. on the phone
  17. Kabir
  18. 0
  19. a named box for a value
  20. 5
  21. Sunrise
  22. a list
  23. 3
  24. Zoya
  25. True
  26. Music
  27. 5
  28. your last game level
  29. Stars
  30. photos on two devices
  31. False
  32. 3
  33. chat messages to friends
  34. 5
  35. 6
  36. data saved on the phone
  37. a class leaderboard
  38. 6
  39. Art
  40. Stars

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