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

Answer key

  1. on the phone
  2. a shared to-do list
  3. Rain
  4. the phone is lost
  5. on the phone
  6. True
  7. Science
  8. 4
  9. False
  10. 4
  11. chat messages to friends
  12. True
  13. 2
  14. in the cloud
  15. notes to read offline
  16. 6
  17. 6
  18. 4
  19. in the cloud
  20. Rain
  21. Music
  22. Riya
  23. the sound on/off setting
  24. a named box for a value
  25. a list
  26. Stars
  27. False
  28. True
  29. Arjun
  30. 5
  31. Rain
  32. False
  33. Sunrise
  34. in the cloud
  35. 12
  36. 4
  37. Meera
  38. 6
  39. 1
  40. True

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