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

Answer key

  1. 5
  2. Rain
  3. 3
  4. 10
  5. True
  6. Aman
  7. a list
  8. 0
  9. False
  10. Hindi
  11. a class leaderboard
  12. Aman
  13. a shared to-do list
  14. Meera
  15. False
  16. data saved on the phone
  17. 4
  18. in the cloud
  19. a named box for a value
  20. on the phone
  21. 4
  22. 4
  23. False
  24. 1
  25. photos on two devices
  26. your last game level
  27. on the phone
  28. 5
  29. on the phone
  30. Kabir
  31. Science
  32. 5
  33. a draft you are typing
  34. False
  35. 5
  36. 3
  37. Zoya
  38. 3
  39. 3
  40. 4

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