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

Answer key

  1. Arjun
  2. 6
  3. False
  4. on the phone
  5. in the cloud
  6. the sound on/off setting
  7. True
  8. 9
  9. False
  10. a named box for a value
  11. Music
  12. 3
  13. Sports
  14. Zoya
  15. Music
  16. on the phone
  17. False
  18. False
  19. the phone is lost
  20. Sunrise
  21. 6
  22. use it on any device
  23. Sunrise
  24. 0
  25. Art
  26. False
  27. True
  28. Stars
  29. a shared to-do list
  30. on the phone
  31. your last game level
  32. Aman
  33. True
  34. 4
  35. Sunrise
  36. 6
  37. 4
  38. 4
  39. on the phone
  40. 3

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