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

Answer key

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

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