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

Answer key

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

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