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

Answer key

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

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