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

Answer key

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

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