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

Answer key

  1. False
  2. notes to read offline
  3. 3
  4. Zoya
  5. a list
  6. on the phone
  7. the phone is lost
  8. a class leaderboard
  9. Music
  10. Art
  11. 7
  12. Sports
  13. 5
  14. 5
  15. Monsoon
  16. 4
  17. 8
  18. 6
  19. True
  20. a named box for a value
  21. Monsoon
  22. 7
  23. True
  24. False
  25. chat messages to friends
  26. False
  27. data saved on the phone
  28. 5
  29. photos on two devices
  30. on the phone
  31. Riya
  32. Music
  33. in the cloud
  34. the sound on/off setting
  35. Hindi
  36. 1
  37. 3
  38. False
  39. 7
  40. True

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