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

Answer key

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

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