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

Answer key

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

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