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

Answer key

  1. 4
  2. Sports
  3. a draft you are typing
  4. in the cloud
  5. in the cloud
  6. 0
  7. on the phone
  8. Maths
  9. Zoya
  10. Aman
  11. a shared to-do list
  12. Arjun
  13. chat messages to friends
  14. 9
  15. True
  16. False
  17. photos on two devices
  18. 5
  19. on the phone
  20. Stars
  21. the phone is lost
  22. 5
  23. the sound on/off setting
  24. on the phone
  25. True
  26. a list
  27. Monsoon
  28. notes to read offline
  29. Maths
  30. True
  31. on the phone
  32. False
  33. False
  34. 5
  35. Stars
  36. Riya
  37. 6
  38. False
  39. 4
  40. your last game level

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