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

Answer key

  1. 3
  2. the phone is lost
  3. a named box for a value
  4. True
  5. chat messages to friends
  6. 4
  7. in the cloud
  8. in the cloud
  9. False
  10. 12
  11. 5
  12. 0
  13. a list
  14. Music
  15. use it on any device
  16. a class leaderboard
  17. True
  18. Aman
  19. on the phone
  20. in the cloud
  21. Stars
  22. False
  23. data saved on the phone
  24. notes to read offline
  25. Riya
  26. on the phone
  27. 3
  28. in the cloud
  29. 12
  30. 6
  31. False
  32. 1
  33. 5
  34. 4
  35. True
  36. on the phone
  37. on the phone
  38. False
  39. Rain
  40. Maths

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