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

Answer key

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

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