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

Answer key

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

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