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

Answer key

  1. True
  2. on the phone
  3. 5
  4. 4
  5. False
  6. 4
  7. 8
  8. 4
  9. in the cloud
  10. on the phone
  11. 0
  12. notes to read offline
  13. Aman
  14. 4
  15. False
  16. on the phone
  17. True
  18. a list
  19. Sports
  20. in the cloud
  21. a shared to-do list
  22. photos on two devices
  23. False
  24. data saved on the phone
  25. Kabir
  26. Arjun
  27. 7
  28. True
  29. 6
  30. 5
  31. 7
  32. 5
  33. 4
  34. Music
  35. True
  36. in the cloud
  37. 4
  38. 6
  39. 2
  40. 3

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