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

Answer key

  1. on the phone
  2. a named box for a value
  3. a list
  4. on the phone
  5. 3
  6. 0
  7. Hindi
  8. 6
  9. 5
  10. use it on any device
  11. on the phone
  12. a shared to-do list
  13. 6
  14. data saved on the phone
  15. on the phone
  16. Zoya
  17. Ocean
  18. 6
  19. Riya
  20. Aman
  21. 6
  22. 8
  23. True
  24. 5
  25. in the cloud
  26. 6
  27. the sound on/off setting
  28. Maths
  29. Monsoon
  30. Art
  31. 4
  32. False
  33. Monsoon
  34. 4
  35. False
  36. Aman
  37. in the cloud
  38. Music
  39. False
  40. 5

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