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

Answer key

  1. Hindi
  2. in the cloud
  3. False
  4. Maths
  5. the phone is lost
  6. Arjun
  7. 9
  8. Ocean
  9. a list
  10. a named box for a value
  11. use it on any device
  12. Rain
  13. False
  14. 7
  15. False
  16. data saved on the phone
  17. 1
  18. 3
  19. in the cloud
  20. on the phone
  21. False
  22. 0
  23. 4
  24. in the cloud
  25. the sound on/off setting
  26. photos on two devices
  27. on the phone
  28. 6
  29. True
  30. False
  31. Rain
  32. on the phone
  33. Music
  34. a shared to-do list
  35. True
  36. Arjun
  37. Sunrise
  38. True
  39. Stars
  40. notes to read offline

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