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

Answer key

  1. on the phone
  2. in the cloud
  3. photos on two devices
  4. 6
  5. False
  6. in the cloud
  7. 5
  8. Stars
  9. your last game level
  10. True
  11. a draft you are typing
  12. False
  13. 5
  14. on the phone
  15. False
  16. Maths
  17. a shared to-do list
  18. 0
  19. 5
  20. Arjun
  21. 4
  22. False
  23. 6
  24. True
  25. notes to read offline
  26. chat messages to friends
  27. Arjun
  28. 3
  29. 4
  30. 7
  31. Music
  32. a named box for a value
  33. True
  34. 4
  35. Kabir
  36. in the cloud
  37. 5
  38. Ocean
  39. 5
  40. 3

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