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

Answer key

  1. True
  2. the sound on/off setting
  3. in the cloud
  4. Riya
  5. on the phone
  6. chat messages to friends
  7. 3
  8. Art
  9. Riya
  10. 4
  11. Monsoon
  12. a list
  13. True
  14. Stars
  15. True
  16. your last game level
  17. Monsoon
  18. True
  19. 6
  20. Ocean
  21. on the phone
  22. False
  23. 3
  24. a class leaderboard
  25. in the cloud
  26. Sunrise
  27. photos on two devices
  28. Music
  29. False
  30. 6
  31. 4
  32. 3
  33. 8
  34. 4
  35. Stars
  36. 4
  37. 5
  38. in the cloud
  39. Maths
  40. Sports

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