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

Answer key

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

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