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

Answer key

  1. use it on any device
  2. a shared to-do list
  3. Maths
  4. Stars
  5. on the phone
  6. 5
  7. notes to read offline
  8. photos on two devices
  9. chat messages to friends
  10. a draft you are typing
  11. Kabir
  12. False
  13. 3
  14. 0
  15. Meera
  16. in the cloud
  17. Ocean
  18. True
  19. 6
  20. your last game level
  21. Riya
  22. the phone is lost
  23. a named box for a value
  24. a list
  25. 4
  26. True
  27. in the cloud
  28. False
  29. Science
  30. 5
  31. Riya
  32. 4
  33. True
  34. 4
  35. Aman
  36. 4
  37. 1
  38. 4
  39. Maths
  40. 3

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