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

Answer key

  1. False
  2. 4
  3. True
  4. data saved on the phone
  5. 6
  6. 3
  7. a class leaderboard
  8. 1
  9. 4
  10. a named box for a value
  11. in the cloud
  12. 4
  13. in the cloud
  14. Rain
  15. False
  16. a list
  17. a draft you are typing
  18. 3
  19. Science
  20. 0
  21. the phone is lost
  22. 9
  23. your last game level
  24. Riya
  25. in the cloud
  26. 2
  27. True
  28. Science
  29. a shared to-do list
  30. 6
  31. Maths
  32. 4
  33. Hindi
  34. Hindi
  35. Sunrise
  36. on the phone
  37. False
  38. notes to read offline
  39. Ocean
  40. True

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