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

Answer key

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

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