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

Answer key

  1. the phone is lost
  2. a named box for a value
  3. Kites
  4. 3
  5. on the phone
  6. 1
  7. 0
  8. chat messages to friends
  9. Sunrise
  10. in the cloud
  11. a shared to-do list
  12. in the cloud
  13. 4
  14. 3
  15. 4
  16. on the phone
  17. 1
  18. Zoya
  19. Maths
  20. data saved on the phone
  21. Sunrise
  22. True
  23. True
  24. False
  25. notes to read offline
  26. True
  27. 5
  28. Kabir
  29. a list
  30. on the phone
  31. 5
  32. False
  33. False
  34. in the cloud
  35. a class leaderboard
  36. Sunrise
  37. Rain
  38. 6
  39. 6
  40. Ocean

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