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

Answer key

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

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