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

Answer key

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

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