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

Answer key

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

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