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

Answer key

  1. Rain
  2. the sound on/off setting
  3. True
  4. 4
  5. True
  6. in the cloud
  7. on the phone
  8. a draft you are typing
  9. Sports
  10. Art
  11. a named box for a value
  12. Sports
  13. Hindi
  14. notes to read offline
  15. the phone is lost
  16. 4
  17. 0
  18. False
  19. on the phone
  20. Meera
  21. Stars
  22. Rain
  23. in the cloud
  24. 5
  25. a class leaderboard
  26. True
  27. use it on any device
  28. Stars
  29. data saved on the phone
  30. True
  31. a list
  32. on the phone
  33. Sunrise
  34. Stars
  35. 4
  36. 6
  37. 5
  38. in the cloud
  39. Music
  40. Sports

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