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

Answer key

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

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