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

Answer key

  1. Hindi
  2. on the phone
  3. notes to read offline
  4. photos on two devices
  5. on the phone
  6. 0
  7. False
  8. a shared to-do list
  9. Science
  10. chat messages to friends
  11. Hindi
  12. in the cloud
  13. the phone is lost
  14. 10
  15. use it on any device
  16. a list
  17. 5
  18. on the phone
  19. on the phone
  20. True
  21. in the cloud
  22. Sunrise
  23. a draft you are typing
  24. 6
  25. 4
  26. Sunrise
  27. 5
  28. Zoya
  29. 4
  30. False
  31. Maths
  32. 6
  33. 4
  34. 4
  35. a named box for a value
  36. data saved on the phone
  37. 5
  38. Aman
  39. 4
  40. 6

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