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

Answer key

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

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