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

Answer key

  1. False
  2. Sports
  3. on the phone
  4. Monsoon
  5. Stars
  6. 5
  7. 4
  8. Monsoon
  9. the phone is lost
  10. False
  11. Sunrise
  12. 4
  13. on the phone
  14. a named box for a value
  15. Stars
  16. False
  17. photos on two devices
  18. on the phone
  19. in the cloud
  20. 6
  21. Meera
  22. notes to read offline
  23. Zoya
  24. Sunrise
  25. Zoya
  26. a draft you are typing
  27. 3
  28. True
  29. data saved on the phone
  30. 4
  31. Stars
  32. 5
  33. 7
  34. 4
  35. Stars
  36. Hindi
  37. 3
  38. 3
  39. a class leaderboard
  40. Art

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