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

Answer key

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

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