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

Answer key

  1. on the phone
  2. True
  3. 5
  4. 3
  5. Ocean
  6. the sound on/off setting
  7. in the cloud
  8. 3
  9. False
  10. a class leaderboard
  11. True
  12. 7
  13. on the phone
  14. the phone is lost
  15. 7
  16. chat messages to friends
  17. 6
  18. a draft you are typing
  19. 5
  20. 0
  21. Maths
  22. 5
  23. data saved on the phone
  24. 4
  25. Kites
  26. Maths
  27. Meera
  28. False
  29. Arjun
  30. 4
  31. 1
  32. notes to read offline
  33. Music
  34. Meera
  35. a named box for a value
  36. Monsoon
  37. False
  38. use it on any device
  39. 4
  40. 10

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