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

Answer key

  1. False
  2. 8
  3. 8
  4. Zoya
  5. True
  6. a list
  7. in the cloud
  8. in the cloud
  9. Art
  10. 4
  11. in the cloud
  12. 4
  13. False
  14. True
  15. 5
  16. in the cloud
  17. 6
  18. 2
  19. the phone is lost
  20. on the phone
  21. 5
  22. chat messages to friends
  23. on the phone
  24. a class leaderboard
  25. your last game level
  26. Music
  27. 6
  28. Science
  29. False
  30. Zoya
  31. 3
  32. Zoya
  33. 2
  34. 9
  35. on the phone
  36. False
  37. 3
  38. True
  39. Aman
  40. Stars

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