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

Answer key

  1. in the cloud
  2. True
  3. the sound on/off setting
  4. Science
  5. Rain
  6. Kites
  7. Kabir
  8. a draft you are typing
  9. 3
  10. 4
  11. False
  12. on the phone
  13. the phone is lost
  14. a shared to-do list
  15. 7
  16. True
  17. Sports
  18. on the phone
  19. 0
  20. 2
  21. photos on two devices
  22. on the phone
  23. True
  24. False
  25. chat messages to friends
  26. Maths
  27. 5
  28. 6
  29. Maths
  30. 5
  31. 5
  32. in the cloud
  33. Stars
  34. in the cloud
  35. Kites
  36. on the phone
  37. 4
  38. 7
  39. 6
  40. 5

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