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

Answer key

  1. a shared to-do list
  2. Sunrise
  3. Stars
  4. 9
  5. a draft you are typing
  6. chat messages to friends
  7. Aman
  8. Stars
  9. Kites
  10. use it on any device
  11. Kites
  12. 6
  13. in the cloud
  14. on the phone
  15. False
  16. Art
  17. a list
  18. Hindi
  19. Rain
  20. notes to read offline
  21. Kites
  22. on the phone
  23. the sound on/off setting
  24. in the cloud
  25. True
  26. 7
  27. 2
  28. 5
  29. Monsoon
  30. Stars
  31. a named box for a value
  32. Rain
  33. False
  34. the phone is lost
  35. 4
  36. False
  37. 7
  38. True
  39. 0
  40. photos on two devices

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