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

Answer key

  1. 7
  2. True
  3. False
  4. Meera
  5. a shared to-do list
  6. on the phone
  7. photos on two devices
  8. Zoya
  9. on the phone
  10. in the cloud
  11. 5
  12. the phone is lost
  13. Arjun
  14. notes to read offline
  15. a draft you are typing
  16. 0
  17. 5
  18. chat messages to friends
  19. 4
  20. Maths
  21. 5
  22. True
  23. Maths
  24. Sports
  25. 10
  26. False
  27. Sports
  28. in the cloud
  29. a named box for a value
  30. on the phone
  31. True
  32. False
  33. Art
  34. Sunrise
  35. Monsoon
  36. in the cloud
  37. 6
  38. 2
  39. Zoya
  40. Sports

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