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

Answer key

  1. Ocean
  2. a named box for a value
  3. 3
  4. Kabir
  5. False
  6. Arjun
  7. on the phone
  8. the sound on/off setting
  9. Kites
  10. in the cloud
  11. notes to read offline
  12. 9
  13. False
  14. in the cloud
  15. Monsoon
  16. Zoya
  17. 4
  18. Zoya
  19. False
  20. 3
  21. use it on any device
  22. a list
  23. 4
  24. in the cloud
  25. Art
  26. 9
  27. 3
  28. chat messages to friends
  29. Arjun
  30. your last game level
  31. 5
  32. the phone is lost
  33. 7
  34. on the phone
  35. 4
  36. photos on two devices
  37. 3
  38. 6
  39. 7
  40. False

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