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

Answer key

  1. False
  2. on the phone
  3. a shared to-do list
  4. a class leaderboard
  5. Stars
  6. True
  7. Zoya
  8. in the cloud
  9. False
  10. Arjun
  11. Riya
  12. Arjun
  13. 0
  14. 5
  15. on the phone
  16. 6
  17. the sound on/off setting
  18. notes to read offline
  19. True
  20. Arjun
  21. a list
  22. data saved on the phone
  23. a draft you are typing
  24. 4
  25. in the cloud
  26. True
  27. 5
  28. 3
  29. 3
  30. 7
  31. 2
  32. False
  33. Hindi
  34. 4
  35. on the phone
  36. False
  37. Kabir
  38. 4
  39. 3
  40. 3

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