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

Answer key

  1. 5
  2. Hindi
  3. on the phone
  4. Science
  5. Arjun
  6. a class leaderboard
  7. Stars
  8. notes to read offline
  9. on the phone
  10. False
  11. on the phone
  12. use it on any device
  13. True
  14. Monsoon
  15. Monsoon
  16. 4
  17. 3
  18. a draft you are typing
  19. 4
  20. Aman
  21. in the cloud
  22. True
  23. Aman
  24. Monsoon
  25. 6
  26. 4
  27. 4
  28. the sound on/off setting
  29. Ocean
  30. Sports
  31. 4
  32. a named box for a value
  33. Kites
  34. False
  35. the phone is lost
  36. 8
  37. 7
  38. False
  39. your last game level
  40. Sports

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