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

Answer key

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

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