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

Answer key

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

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