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

Answer key

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

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