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

Answer key

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

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