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

Answer key

  1. Meera
  2. 4
  3. 4
  4. on the phone
  5. use it on any device
  6. False
  7. the phone is lost
  8. your last game level
  9. 5
  10. 6
  11. a named box for a value
  12. the sound on/off setting
  13. 4
  14. on the phone
  15. a draft you are typing
  16. chat messages to friends
  17. in the cloud
  18. in the cloud
  19. 3
  20. False
  21. Art
  22. 6
  23. False
  24. False
  25. True
  26. Zoya
  27. True
  28. Sports
  29. data saved on the phone
  30. False
  31. 5
  32. Art
  33. True
  34. on the phone
  35. True
  36. Art
  37. Stars
  38. True
  39. Ocean
  40. False

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