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

Answer key

  1. 4
  2. Science
  3. False
  4. 11
  5. Sunrise
  6. 2
  7. notes to read offline
  8. 6
  9. a list
  10. False
  11. a class leaderboard
  12. data saved on the phone
  13. Music
  14. on the phone
  15. 6
  16. in the cloud
  17. True
  18. chat messages to friends
  19. Stars
  20. a draft you are typing
  21. on the phone
  22. 5
  23. Science
  24. Sports
  25. in the cloud
  26. 6
  27. in the cloud
  28. your last game level
  29. Music
  30. on the phone
  31. 5
  32. True
  33. False
  34. 4
  35. Kabir
  36. 4
  37. a named box for a value
  38. Kabir
  39. on the phone
  40. Science

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