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

Answer key

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

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