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

Answer key

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

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