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

Answer key

  1. in the cloud
  2. 5
  3. 5
  4. 7
  5. in the cloud
  6. a list
  7. 3
  8. Kabir
  9. 4
  10. 5
  11. True
  12. on the phone
  13. use it on any device
  14. False
  15. 6
  16. False
  17. Rain
  18. 5
  19. notes to read offline
  20. 0
  21. Kabir
  22. Kites
  23. True
  24. Meera
  25. Sports
  26. Rain
  27. the sound on/off setting
  28. Sunrise
  29. Sports
  30. Science
  31. photos on two devices
  32. False
  33. Sports
  34. 5
  35. Art
  36. False
  37. 6
  38. Riya
  39. on the phone
  40. Ocean

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