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

Answer key

  1. the phone is lost
  2. in the cloud
  3. in the cloud
  4. Monsoon
  5. chat messages to friends
  6. 10
  7. 5
  8. use it on any device
  9. on the phone
  10. False
  11. 0
  12. False
  13. True
  14. in the cloud
  15. 5
  16. 4
  17. Arjun
  18. False
  19. a shared to-do list
  20. a class leaderboard
  21. Art
  22. 10
  23. Art
  24. Art
  25. Sports
  26. photos on two devices
  27. True
  28. on the phone
  29. Hindi
  30. Rain
  31. True
  32. 2
  33. on the phone
  34. Music
  35. 3
  36. 9
  37. Arjun
  38. a named box for a value
  39. Hindi
  40. False

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