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

Answer key

  1. 6
  2. Kabir
  3. Sunrise
  4. on the phone
  5. False
  6. data saved on the phone
  7. Maths
  8. True
  9. Art
  10. a named box for a value
  11. on the phone
  12. in the cloud
  13. False
  14. 5
  15. the phone is lost
  16. Art
  17. 4
  18. a class leaderboard
  19. False
  20. a shared to-do list
  21. 1
  22. True
  23. 4
  24. 6
  25. 6
  26. in the cloud
  27. 5
  28. a list
  29. Sunrise
  30. Kites
  31. False
  32. 4
  33. 3
  34. False
  35. Maths
  36. True
  37. your last game level
  38. 9
  39. Sunrise
  40. 4

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