Engineering Maintainable Android Apps, which is a 4 week MOOC that shows by example various methods for engineering maintainable Android apps, including test-driven development methods and how to develop/run unit tests using JUnit and Robotium (or equivalent automated testing frameworks for Android), as well as how to successfully apply common Java/Android software patterns to improve the extensibility and clarity of Android apps.
Students will work on the appropriate automated unit quizzes, based on the material covered in the lecture videos. These lessons will demonstrate the benefits of good software engineering practices that are targeted at creating maintainable code for mobile apps.
There will be roughly 3-4 hours of student engagement time per week, including video lectures, and quizzes. The ordering of the modules within the course is designed to be flexible.
In particular, students can watch the videos in whatever order suits their experience and needs, e.g., they may want to watch the unit testing videos prior to the software pattern videos if they prefer to learn about unit testing first.
Enroll on Coursera
Q1. Which of the following are reasons to write tests (select all that apply)?
Q2. When building a new app, which of the following are true (select all that apply)?
Q3. What is a unit test (select all that apply)?
Q4. Which Java framework is used to write unit tests in Android (select all that apply)?
Q5. Why is it important for unit tests to run quickly (select all that apply)?
Q6. Which of the following is a valid, although not useful, JUnit test (select all that apply)?
Q7. Which of the following is not an appropriate way to setup the state for MyObject in the test below (select all that apply)?
@Test public void testInitialName() { assertEquals(“bob”, myObject.getName());}
@Test public void testInitialName() { myObject = new MyObject(); assertEquals(“bob”, myObject.getName());}
@Test public void testInitialSize() {
@Before public void setUp(){ myObject = new MyObject(); }
@Test public void testInitialName() { assertEquals(“bob”, myObject.getName());
@Before public void setUp(){ myObject = new MyObject ();}
@Test public void testInitialName() {assertEquals(“bob”, myObject.getName());
@Test public void testInitialName() { assertEquals(“bob”, myObject.getName()); }
@Test public void testInitialSize() { assertEquals(10, myObject.getSize());
Q8. Assume that the MyObject.dangerous() function throws a checked exception. Which of the following are valid ways to write a test of MyObject (select all that apply).
Q9. What are valid uses of code coverage metrics (select all that apply)?
Q10. Which of the following are true about the test shown below (select all that apply):
12345678910111213
public class SomeTest {
private MyObject myObject = new MyObject();
@Test
public void testInitialName() {
assertEquals(“bob”,myObject.getName());
}
@Test
public void testInitialSize() {
Q1. What is an Android Instrumentation Test (select all that apply)?
Q2. Which of the following are true of unit tests vs. integration tests (select all that apply)?
Q3. Which of the following creates a valid mock PostalCodeProvider that will return “37212” for the following call (select all that apply):
1 postalCodeProvider.getPostalCode(2.11, 3.09)
@RunWith(MockitoJUnitRunner.class)
public class GeoUtilsTest {
@Mock
private PostalCodeProvider postalCodeProvider;
@Before
public void setUp() {
when(
postalCodeProvider
@RunWith(MockitoJUnitRunner.class)
public class GeoUtilsTest {
@Mock
private PostalCodeProvider postalCodeProvider;
@Before
public void setUp() {
when(
postalCodeProvider
@RunWith(MockitoJUnitRunner.class)
public class GeoUtilsTest {
@Mock
private PostalCodeProvider postalCodeProvider;
@Before
public void setUp() {
on(
postalCodeProvider
@RunWith(MockitoJUnitRunner.class)
public class GeoUtilsTest {
@Mock
private PostalCodeProvider postalCodeProvider;
@Before
public void setUp() {
when(
postalCodeProvider
@RunWith(MockitoJUnitRunner.class)
public class GeoUtilsTest {
@Mock
private PostalCodeProvider postalCodeProvider;
@Before
public void setUp() {
when(
postalCodeProvider
Q4. Which of the following are true (select all that apply)?
Q5. What will be the result of line 19 (select all that apply)?
12345678910111213141516171819202122
@RunWith(MockitoJUnitRunner.class)
public class GeoUtilsTest {
@Mock
private Foo foo;
@Mock
private Bar bar;
@Before
Q6. What could be added on line 6 below to ensure that the view with ID R.id.errorMessage is visible on screen and has the contents “Bad password” (select all that apply)?
[email protected] public void testPasswordLengthRuleTriggersErrorMsg() {
onView(withId(R.id.passwordEditText)).perform(typeText(“abc”));
onView(withId(R.id.loginButton)).perform(click());
// What should be added here }
Q7. Which of the following are true of refactoring (select all that apply)?
Q8. What code could be added to insert text into the R.id.welcome TextView (select all that apply)?
Q9. What is the purpose of regression testing (select all that apply)?
Q10. Which of the following are non-functional properties (select all that apply)?
Q1. Which of the following is true of the economy of mechanism design principle (select all that apply)?
Q2. Assuming that “runner” is the only implementation of Runner and never needs to be changed, which of the following refactorings of the code shown below would best demonstrate the economy of mechanism design principle (select all that apply)?
public class DataHandler {
public interface Runner {
public void run(Runnable r);
}
private final ExecutorService executor = Executors.newFixedThreadPool(1);
private final Runner runner = new Runner() {
public void run(Runnable q){
public class DataHandler {
public interface Runner {
public void run(Runnable r);
}
private class MyRunner {
public void run(Runnable q){
executor.submit(q);
}
public class DataHandler {
private ExecutorService executor;
public DataHandler() {
executor = Executors.newFixedThreadPool(1);
runner = new MyRunner();
}
public void runIt(ExecutorService r, Runnable q){
public class DataHandler {
private final ExecutorService executor = Executors.newFixedThreadPool(1);
public void fetchData() {
executor.submit(new FetchDataTask());
}
public void writeData() {
executor.submit(new WriteDataTask());
public class DataHandler { private ExecutorService executor;
public DataHandler(ExecutorService ex){
executor = ex; }public void fetchData() {
executor.submit(new FetchDataTask());
Q3. Which of the following are reasons why the principle of least privilege is important (select all that apply)?
Q4. In Android, which of the following are true of apps that do not apply the principle of least privilege (select all that apply)?
Q5. Which of the following could be examples of secure defaults (select all that apply)?
Q6. Why are secure defaults important (select all that apply)?
Q7. Which of the following is an example of secure defaults (select all that apply)?
Map storageEngines = new HashMap<>();
public void init() {
storageEngines.put(“secure”, new EncryptedStorageEngine());
storageEngines.put(“plain”, new PlainTextStorageEngine()); }
public void store(String type, String data){
storageEngines.get(type).store(data); }
Map storageEngines = new HashMap<>();
public void init() {
storageEngines.put(“secure”, new EncryptedStorageEngine());
storageEngines.put(“plain”, new PlainTextStorageEngine()); }
public void store(String type, String data){
if(storageEngines.get(type)!=null){
storageEngines.get(type).store(data);
Map storageEngines = new HashMap<>();
private encryptedEngine = new EncryptedStorageEngine();
public void init() {
storageEngines.put(“secure”, encryptedEngine);
storageEngines.put(“plain”, new PlainTextStorageEngine()); }
public void store(String type, String data){
Q8. A number of recent news articles have highlighted apps that asked for a large number of uses-permissions. Which design principle are these apps most likely to violate (select all that apply)?
Q9. What is wrong with the code below (select all that apply)?
123456789101112
public static int SECURE = 1;
public static int MOST_SECURE = 2;
public static int INSECURE = 0;
public void sendData(int securityLevel, String data){
if(securityLevel > 0){
sendEncrypted(data);
}
else if(securityLevel == 0){
sendPlainText(data);
Q10. When is it appropriate to ignore these security principles in order to develop new functionality (select all that apply)?
Q1. Which of the following are ways that Android protects your app (select all that apply)?
Q2. What is the potential security issue with the code shown below (select all that apply)?
12345678910111213141516171819
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Get the intent that started this activity
Intent intent = getIntent();
String uri = intent.getStringExtra("uri");
startDownload(uri);
Q3. Security mistakes are made due to which of the following reasons (select all that apply)?
Q4. On an Android device, when is a Linux user account created (select all that apply)?
Q5. Which of the following are true on Android (select all that apply)?
I hope this Engineering Maintainable Android Apps Coursera Quiz Answers would be useful for you to learn something new from the Course. If it helped you, don’t forget to bookmark our site for more Quiz Answers.
This course is intended for audiences of all experiences who are interested in learning about new skills in a business context; there are no prerequisite courses.
Keep Learning!
Java for Android Coursera Quiz Answers
Android App Components – Intents, Activities, and Broadcast Receivers Quiz Answers
Android App Components – Services, Local IPC, and Content Providers Quiz Answers
Engineering Maintainable Android Apps Quiz Answers
Sadza is a simple, hearty dish that forms the backbone of many Zimbabwean meals. It's…
Caesar Salad A classic Caesar salad is a simple yet flavorful dish with crisp romaine…
Zimsec and Cambridge past exam papers free download pdfs on eduzim
Zimsec and Cambridge past exam papers free download pdfs on eduzim
Zimsec and Cambridge past exam papers free download pdfs on eduzim
Pacific – A Level Physics – Convection and Radiation pdf download
View Comments
there are no answers
Havent noticed. sorry. Will fix that
There are no answers
There are no answers
Can you fix it please sos