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

Answer key

  1. True
  2. Hindi
  3. Maths
  4. a named box for a value
  5. Science
  6. Meera
  7. the phone is lost
  8. True
  9. Kites
  10. on the phone
  11. a list
  12. in the cloud
  13. False
  14. False
  15. False
  16. 4
  17. True
  18. your last game level
  19. 0
  20. False
  21. False
  22. in the cloud
  23. a draft you are typing
  24. False
  25. 4
  26. Science
  27. Kabir
  28. Sunrise
  29. Ocean
  30. Sports
  31. 5
  32. 6
  33. on the phone
  34. in the cloud
  35. 11
  36. False
  37. Riya
  38. a shared to-do list
  39. Zoya
  40. chat messages to friends

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