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

Answer key

  1. False
  2. 5
  3. on the phone
  4. chat messages to friends
  5. your last game level
  6. a named box for a value
  7. False
  8. a shared to-do list
  9. on the phone
  10. Kites
  11. data saved on the phone
  12. Zoya
  13. use it on any device
  14. 11
  15. 3
  16. a draft you are typing
  17. Science
  18. 4
  19. Hindi
  20. on the phone
  21. 12
  22. photos on two devices
  23. True
  24. False
  25. Aman
  26. Zoya
  27. a list
  28. 6
  29. a class leaderboard
  30. 3
  31. 6
  32. on the phone
  33. the sound on/off setting
  34. Stars
  35. Monsoon
  36. Hindi
  37. 0
  38. 5
  39. 7
  40. Kites

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