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

Answer key

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

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