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

Answer key

  1. Riya
  2. your last game level
  3. False
  4. on the phone
  5. True
  6. False
  7. in the cloud
  8. False
  9. Science
  10. a class leaderboard
  11. 3
  12. True
  13. 7
  14. 3
  15. Meera
  16. in the cloud
  17. in the cloud
  18. 4
  19. Kites
  20. use it on any device
  21. Meera
  22. a named box for a value
  23. True
  24. 0
  25. 4
  26. on the phone
  27. the phone is lost
  28. 7
  29. 4
  30. 10
  31. 4
  32. 5
  33. Science
  34. a draft you are typing
  35. 4
  36. True
  37. True
  38. Science
  39. False
  40. a shared to-do list

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