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

Answer key

  1. False
  2. False
  3. Kabir
  4. on the phone
  5. 6
  6. on the phone
  7. 4
  8. Ocean
  9. chat messages to friends
  10. 2
  11. False
  12. False
  13. Stars
  14. a named box for a value
  15. 7
  16. Meera
  17. Art
  18. use it on any device
  19. a class leaderboard
  20. in the cloud
  21. your last game level
  22. Hindi
  23. a list
  24. the sound on/off setting
  25. Riya
  26. the phone is lost
  27. True
  28. 5
  29. 3
  30. 4
  31. photos on two devices
  32. Stars
  33. Hindi
  34. on the phone
  35. Art
  36. 3
  37. True
  38. a draft you are typing
  39. 3
  40. 0

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