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

Answer key

  1. 3
  2. Science
  3. a list
  4. on the phone
  5. True
  6. True
  7. in the cloud
  8. in the cloud
  9. Sunrise
  10. Kites
  11. the phone is lost
  12. 8
  13. 3
  14. False
  15. Riya
  16. Aman
  17. use it on any device
  18. Meera
  19. Kabir
  20. 7
  21. Meera
  22. 7
  23. in the cloud
  24. 6
  25. a named box for a value
  26. on the phone
  27. Arjun
  28. a class leaderboard
  29. the sound on/off setting
  30. on the phone
  31. 4
  32. notes to read offline
  33. Ocean
  34. data saved on the phone
  35. 5
  36. 4
  37. Rain
  38. Kites
  39. 5
  40. Science

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