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

Answer key

  1. on the phone
  2. 3
  3. 4
  4. Aman
  5. False
  6. chat messages to friends
  7. Rain
  8. Kites
  9. Sunrise
  10. in the cloud
  11. True
  12. Science
  13. True
  14. True
  15. True
  16. a named box for a value
  17. your last game level
  18. Stars
  19. 0
  20. Rain
  21. notes to read offline
  22. a shared to-do list
  23. 4
  24. 3
  25. Zoya
  26. True
  27. on the phone
  28. 3
  29. Art
  30. False
  31. Maths
  32. Ocean
  33. Meera
  34. 1
  35. 4
  36. Aman
  37. in the cloud
  38. on the phone
  39. the phone is lost
  40. False

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