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

Answer key

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

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