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

Answer key

  1. 6
  2. the sound on/off setting
  3. in the cloud
  4. a list
  5. data saved on the phone
  6. 0
  7. False
  8. Kites
  9. 8
  10. 2
  11. a named box for a value
  12. in the cloud
  13. 6
  14. your last game level
  15. Sunrise
  16. 6
  17. 6
  18. on the phone
  19. Zoya
  20. Ocean
  21. on the phone
  22. on the phone
  23. True
  24. the phone is lost
  25. use it on any device
  26. Sunrise
  27. notes to read offline
  28. chat messages to friends
  29. False
  30. 3
  31. a draft you are typing
  32. a class leaderboard
  33. photos on two devices
  34. 8
  35. 5
  36. Music
  37. 5
  38. 5
  39. 4
  40. Aman

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