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

Answer key

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

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