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

Answer key

  1. the phone is lost
  2. Ocean
  3. notes to read offline
  4. Kites
  5. Meera
  6. True
  7. 5
  8. Rain
  9. Ocean
  10. 6
  11. a draft you are typing
  12. False
  13. 6
  14. a list
  15. on the phone
  16. 5
  17. chat messages to friends
  18. use it on any device
  19. data saved on the phone
  20. 10
  21. 5
  22. a shared to-do list
  23. on the phone
  24. Kabir
  25. in the cloud
  26. False
  27. False
  28. Art
  29. Ocean
  30. Rain
  31. your last game level
  32. Hindi
  33. False
  34. 4
  35. 10
  36. True
  37. a named box for a value
  38. 5
  39. False
  40. Kabir

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