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

Answer key

  1. a class leaderboard
  2. the phone is lost
  3. 4
  4. Riya
  5. your last game level
  6. Zoya
  7. 3
  8. 0
  9. chat messages to friends
  10. photos on two devices
  11. 3
  12. a named box for a value
  13. 3
  14. 5
  15. 8
  16. Arjun
  17. Stars
  18. 3
  19. Kabir
  20. on the phone
  21. 3
  22. 6
  23. in the cloud
  24. in the cloud
  25. False
  26. 4
  27. Hindi
  28. notes to read offline
  29. 4
  30. data saved on the phone
  31. Science
  32. 3
  33. 5
  34. on the phone
  35. 3
  36. True
  37. in the cloud
  38. a list
  39. Riya
  40. True

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