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

Answer key

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

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