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

Answer key

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

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