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

Answer key

  1. use it on any device
  2. 5
  3. 6
  4. a draft you are typing
  5. Ocean
  6. False
  7. Sunrise
  8. True
  9. 5
  10. Maths
  11. in the cloud
  12. Sports
  13. photos on two devices
  14. a shared to-do list
  15. a named box for a value
  16. a list
  17. notes to read offline
  18. False
  19. 6
  20. Aman
  21. Aman
  22. in the cloud
  23. 3
  24. 5
  25. Music
  26. Arjun
  27. Rain
  28. data saved on the phone
  29. Aman
  30. 4
  31. on the phone
  32. False
  33. True
  34. Ocean
  35. 8
  36. 8
  37. a class leaderboard
  38. Monsoon
  39. True
  40. 0

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