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

Answer key

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

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