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

Answer key

  1. 6
  2. the sound on/off setting
  3. False
  4. a named box for a value
  5. 2
  6. True
  7. in the cloud
  8. False
  9. in the cloud
  10. Rain
  11. a list
  12. chat messages to friends
  13. Riya
  14. 6
  15. 2
  16. True
  17. False
  18. on the phone
  19. data saved on the phone
  20. 8
  21. on the phone
  22. True
  23. 5
  24. 13
  25. Riya
  26. False
  27. 6
  28. 8
  29. on the phone
  30. use it on any device
  31. Maths
  32. Riya
  33. Monsoon
  34. True
  35. photos on two devices
  36. 5
  37. 5
  38. a class leaderboard
  39. False
  40. a draft you are typing

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