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

Answer key

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

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