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

Answer key

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

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