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

Answer key

  1. data saved on the phone
  2. Aman
  3. on the phone
  4. a list
  5. True
  6. 8
  7. your last game level
  8. a named box for a value
  9. 6
  10. 4
  11. 3
  12. 4
  13. the phone is lost
  14. on the phone
  15. 4
  16. False
  17. True
  18. in the cloud
  19. Arjun
  20. False
  21. on the phone
  22. a draft you are typing
  23. in the cloud
  24. 4
  25. 5
  26. 4
  27. Kabir
  28. the sound on/off setting
  29. 4
  30. False
  31. Sunrise
  32. 4
  33. False
  34. False
  35. Maths
  36. 6
  37. 7
  38. True
  39. 5
  40. a class leaderboard

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