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

Answer key

  1. False
  2. 4
  3. Kabir
  4. 0
  5. in the cloud
  6. Kabir
  7. a draft you are typing
  8. 5
  9. on the phone
  10. 2
  11. Stars
  12. a list
  13. use it on any device
  14. Sports
  15. Zoya
  16. on the phone
  17. False
  18. True
  19. notes to read offline
  20. Maths
  21. 4
  22. Zoya
  23. False
  24. Science
  25. False
  26. photos on two devices
  27. Rain
  28. 6
  29. Art
  30. 4
  31. the phone is lost
  32. Music
  33. True
  34. Riya
  35. True
  36. 6
  37. on the phone
  38. 4
  39. True
  40. data saved on the phone

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