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

Answer key

  1. a class leaderboard
  2. 4
  3. on the phone
  4. the phone is lost
  5. Rain
  6. the sound on/off setting
  7. Sports
  8. use it on any device
  9. Kabir
  10. on the phone
  11. on the phone
  12. on the phone
  13. 9
  14. Aman
  15. Arjun
  16. 2
  17. Music
  18. False
  19. Maths
  20. in the cloud
  21. Sports
  22. 3
  23. Rain
  24. 8
  25. False
  26. Maths
  27. False
  28. False
  29. True
  30. Music
  31. your last game level
  32. Sunrise
  33. Sunrise
  34. a list
  35. data saved on the phone
  36. 0
  37. Music
  38. 4
  39. 11
  40. a named box for a value

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