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

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