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

Answer key

  1. Science
  2. False
  3. notes to read offline
  4. on the phone
  5. a shared to-do list
  6. a class leaderboard
  7. the phone is lost
  8. photos on two devices
  9. on the phone
  10. 4
  11. in the cloud
  12. in the cloud
  13. 6
  14. 5
  15. 0
  16. 6
  17. in the cloud
  18. False
  19. True
  20. True
  21. chat messages to friends
  22. 4
  23. 5
  24. Science
  25. in the cloud
  26. True
  27. a list
  28. True
  29. 4
  30. a named box for a value
  31. 5
  32. Aman
  33. 10
  34. on the phone
  35. 3
  36. Stars
  37. Ocean
  38. 5
  39. 3
  40. Sunrise

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