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

Answer key

  1. 4
  2. the phone is lost
  3. on the phone
  4. Art
  5. in the cloud
  6. False
  7. a list
  8. 4
  9. use it on any device
  10. Aman
  11. Sports
  12. 3
  13. 0
  14. 3
  15. on the phone
  16. 3
  17. True
  18. Arjun
  19. Arjun
  20. False
  21. in the cloud
  22. False
  23. True
  24. data saved on the phone
  25. on the phone
  26. 6
  27. 5
  28. 6
  29. 9
  30. 4
  31. True
  32. on the phone
  33. 4
  34. a named box for a value
  35. 5
  36. True
  37. True
  38. Kabir
  39. Art
  40. Sunrise

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