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

Answer key

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

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