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

Answer key

  1. Rain
  2. on the phone
  3. on the phone
  4. in the cloud
  5. 6
  6. Maths
  7. use it on any device
  8. 5
  9. a list
  10. 5
  11. 6
  12. your last game level
  13. the phone is lost
  14. Hindi
  15. 5
  16. Stars
  17. 5
  18. 0
  19. True
  20. 7
  21. in the cloud
  22. a draft you are typing
  23. Monsoon
  24. on the phone
  25. 8
  26. 5
  27. False
  28. 7
  29. Maths
  30. chat messages to friends
  31. Art
  32. Rain
  33. True
  34. 4
  35. on the phone
  36. 4
  37. the sound on/off setting
  38. 9
  39. 5
  40. Monsoon

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