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

Answer key

  1. 0
  2. 3
  3. 7
  4. True
  5. Stars
  6. use it on any device
  7. 4
  8. Sunrise
  9. on the phone
  10. a named box for a value
  11. a list
  12. Art
  13. 6
  14. a shared to-do list
  15. the phone is lost
  16. Sunrise
  17. Monsoon
  18. in the cloud
  19. 3
  20. False
  21. notes to read offline
  22. 3
  23. Sunrise
  24. Aman
  25. data saved on the phone
  26. True
  27. Zoya
  28. your last game level
  29. Hindi
  30. Sunrise
  31. on the phone
  32. 7
  33. photos on two devices
  34. Rain
  35. 4
  36. in the cloud
  37. Kites
  38. 4
  39. True
  40. Science

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