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

Answer key

  1. Sports
  2. Stars
  3. the sound on/off setting
  4. in the cloud
  5. 3
  6. photos on two devices
  7. a named box for a value
  8. False
  9. use it on any device
  10. in the cloud
  11. 3
  12. 5
  13. True
  14. Science
  15. 4
  16. Art
  17. 11
  18. Kites
  19. Music
  20. 5
  21. False
  22. 0
  23. 6
  24. 3
  25. in the cloud
  26. a list
  27. False
  28. Maths
  29. Sports
  30. the phone is lost
  31. Sunrise
  32. 2
  33. False
  34. Riya
  35. a class leaderboard
  36. False
  37. 5
  38. 7
  39. 5
  40. notes to read offline

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