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

Answer key

  1. data saved on the phone
  2. 4
  3. a shared to-do list
  4. Monsoon
  5. in the cloud
  6. True
  7. 4
  8. Hindi
  9. the phone is lost
  10. photos on two devices
  11. a class leaderboard
  12. 4
  13. on the phone
  14. 9
  15. False
  16. Kites
  17. False
  18. 4
  19. 3
  20. True
  21. Zoya
  22. 4
  23. Maths
  24. Art
  25. a draft you are typing
  26. Sports
  27. 0
  28. a list
  29. the sound on/off setting
  30. Hindi
  31. Rain
  32. in the cloud
  33. Sunrise
  34. 3
  35. on the phone
  36. 5
  37. use it on any device
  38. 3
  39. Stars
  40. on the phone

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