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

Answer key

  1. in the cloud
  2. in the cloud
  3. False
  4. 3
  5. Sports
  6. Ocean
  7. chat messages to friends
  8. 12
  9. use it on any device
  10. on the phone
  11. 7
  12. the sound on/off setting
  13. a named box for a value
  14. 6
  15. 4
  16. True
  17. 3
  18. in the cloud
  19. 4
  20. Sunrise
  21. Sunrise
  22. photos on two devices
  23. 0
  24. data saved on the phone
  25. True
  26. on the phone
  27. 4
  28. on the phone
  29. 4
  30. Hindi
  31. Kabir
  32. 5
  33. a list
  34. 3
  35. Sunrise
  36. True
  37. 7
  38. on the phone
  39. Kabir
  40. Aman

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