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

Answer key

  1. notes to read offline
  2. a list
  3. Rain
  4. Zoya
  5. True
  6. 4
  7. photos on two devices
  8. 4
  9. Sports
  10. use it on any device
  11. on the phone
  12. a draft you are typing
  13. Kites
  14. 5
  15. Aman
  16. False
  17. 5
  18. chat messages to friends
  19. a named box for a value
  20. 3
  21. True
  22. Sunrise
  23. 3
  24. the phone is lost
  25. 8
  26. Kites
  27. True
  28. data saved on the phone
  29. Riya
  30. Meera
  31. a shared to-do list
  32. Aman
  33. False
  34. 4
  35. Meera
  36. in the cloud
  37. 5
  38. 5
  39. a class leaderboard
  40. on the phone

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