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

Answer key

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

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