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

Answer key

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

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