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

Answer key

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

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