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

Answer key

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

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