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

Answer key

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

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