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

Answer key

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

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