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

Answer key

  1. False
  2. on the phone
  3. False
  4. 4
  5. 4
  6. in the cloud
  7. Riya
  8. 1
  9. False
  10. a named box for a value
  11. a list
  12. the phone is lost
  13. in the cloud
  14. True
  15. Meera
  16. 5
  17. 6
  18. Hindi
  19. on the phone
  20. Arjun
  21. Art
  22. on the phone
  23. the sound on/off setting
  24. Ocean
  25. Music
  26. use it on any device
  27. Sports
  28. Zoya
  29. 1
  30. True
  31. 4
  32. 3
  33. your last game level
  34. 5
  35. a shared to-do list
  36. 3
  37. 2
  38. False
  39. notes to read offline
  40. on the phone

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