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

Answer key

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

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