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

Answer key

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

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