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

Answer key

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

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