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

Answer key

  1. True
  2. 5
  3. in the cloud
  4. the phone is lost
  5. your last game level
  6. 5
  7. Kites
  8. 5
  9. in the cloud
  10. a named box for a value
  11. data saved on the phone
  12. True
  13. Rain
  14. a class leaderboard
  15. in the cloud
  16. on the phone
  17. chat messages to friends
  18. Stars
  19. Meera
  20. photos on two devices
  21. Zoya
  22. 7
  23. 6
  24. 3
  25. the sound on/off setting
  26. 0
  27. in the cloud
  28. 5
  29. Rain
  30. 5
  31. 4
  32. 6
  33. 8
  34. a shared to-do list
  35. 3
  36. a list
  37. use it on any device
  38. False
  39. 5
  40. False

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