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

Answer key

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

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