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

Answer key

  1. 4
  2. a class leaderboard
  3. on the phone
  4. 2
  5. True
  6. the phone is lost
  7. True
  8. True
  9. notes to read offline
  10. chat messages to friends
  11. data saved on the phone
  12. Sunrise
  13. in the cloud
  14. 5
  15. 6
  16. False
  17. Stars
  18. 5
  19. a draft you are typing
  20. 3
  21. Science
  22. Kabir
  23. use it on any device
  24. 6
  25. in the cloud
  26. on the phone
  27. 1
  28. the sound on/off setting
  29. Arjun
  30. in the cloud
  31. on the phone
  32. False
  33. a list
  34. Science
  35. Maths
  36. 5
  37. False
  38. 3
  39. Art
  40. Arjun

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