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

Answer key

  1. Music
  2. Meera
  3. Art
  4. True
  5. False
  6. 0
  7. in the cloud
  8. 6
  9. data saved on the phone
  10. chat messages to friends
  11. on the phone
  12. False
  13. the phone is lost
  14. Zoya
  15. in the cloud
  16. on the phone
  17. 4
  18. a named box for a value
  19. Sports
  20. your last game level
  21. in the cloud
  22. Meera
  23. use it on any device
  24. 4
  25. in the cloud
  26. the sound on/off setting
  27. on the phone
  28. photos on two devices
  29. Kabir
  30. notes to read offline
  31. 4
  32. Music
  33. a draft you are typing
  34. 6
  35. a shared to-do list
  36. Kites
  37. 9
  38. True
  39. 3
  40. Sunrise

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