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

Answer key

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

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