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

Answer key

  1. the sound on/off setting
  2. 6
  3. a class leaderboard
  4. photos on two devices
  5. a draft you are typing
  6. a named box for a value
  7. Sports
  8. Hindi
  9. Kites
  10. the phone is lost
  11. in the cloud
  12. 7
  13. a shared to-do list
  14. Science
  15. 6
  16. in the cloud
  17. True
  18. in the cloud
  19. 5
  20. on the phone
  21. 4
  22. 5
  23. Stars
  24. 3
  25. your last game level
  26. data saved on the phone
  27. True
  28. Maths
  29. 4
  30. 4
  31. 3
  32. True
  33. Sports
  34. 0
  35. 4
  36. True
  37. 6
  38. Sunrise
  39. on the phone
  40. Sports

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