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

Answer key

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

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