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

Answer key

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

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