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

Answer key

  1. on the phone
  2. chat messages to friends
  3. Kites
  4. 5
  5. Music
  6. Riya
  7. Sports
  8. 5
  9. a named box for a value
  10. the phone is lost
  11. photos on two devices
  12. 7
  13. Science
  14. data saved on the phone
  15. Art
  16. True
  17. on the phone
  18. Kites
  19. the sound on/off setting
  20. Stars
  21. True
  22. Maths
  23. on the phone
  24. 3
  25. Monsoon
  26. Art
  27. False
  28. Science
  29. 4
  30. in the cloud
  31. True
  32. Sports
  33. a list
  34. Riya
  35. 4
  36. 3
  37. your last game level
  38. 5
  39. True
  40. 4

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