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

Answer key

  1. photos on two devices
  2. a named box for a value
  3. Kites
  4. Aman
  5. 5
  6. data saved on the phone
  7. 0
  8. 5
  9. 7
  10. Ocean
  11. True
  12. a shared to-do list
  13. 5
  14. Hindi
  15. 3
  16. 3
  17. False
  18. False
  19. 6
  20. Rain
  21. a list
  22. Rain
  23. on the phone
  24. Riya
  25. 1
  26. 4
  27. True
  28. in the cloud
  29. on the phone
  30. False
  31. 3
  32. in the cloud
  33. on the phone
  34. Aman
  35. Sunrise
  36. Ocean
  37. 5
  38. 5
  39. 3
  40. 4

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