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

Answer key

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

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