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

Answer key

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

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