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

Answer key

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

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