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

Answer key

  1. 3
  2. your last game level
  3. 6
  4. Arjun
  5. Rain
  6. Riya
  7. on the phone
  8. data saved on the phone
  9. True
  10. True
  11. Hindi
  12. Monsoon
  13. 4
  14. Kites
  15. False
  16. 3
  17. on the phone
  18. True
  19. Sunrise
  20. on the phone
  21. Sunrise
  22. a list
  23. Zoya
  24. False
  25. 4
  26. chat messages to friends
  27. Kabir
  28. in the cloud
  29. 3
  30. Art
  31. 5
  32. in the cloud
  33. 5
  34. 3
  35. the phone is lost
  36. Riya
  37. 3
  38. 2
  39. in the cloud
  40. Aman

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