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

Answer key

  1. 6
  2. a draft you are typing
  3. your last game level
  4. 3
  5. 0
  6. 4
  7. True
  8. a named box for a value
  9. False
  10. on the phone
  11. the sound on/off setting
  12. Sunrise
  13. chat messages to friends
  14. Music
  15. in the cloud
  16. Arjun
  17. notes to read offline
  18. use it on any device
  19. in the cloud
  20. True
  21. a list
  22. 4
  23. True
  24. 5
  25. 4
  26. data saved on the phone
  27. Ocean
  28. 5
  29. Science
  30. Maths
  31. Ocean
  32. on the phone
  33. 9
  34. 4
  35. Kites
  36. False
  37. Rain
  38. False
  39. 4
  40. Ocean

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