1802/159.251 辅导、 写作Java课程编程

” 1802/159.251 辅导、 写作Java课程编程Page 1 of 9 COS1802/159.251MTUI DISDMASSEY UNIVERSITYMANAWATU AND DISTANCE CAMPUSESEXAMINATION FOR159.251 SOFTWARE ENGINEERING DESIGN AND CONSTRUCTIONSEMESTER TWO 2018_________________________________________________________________________________________________________Time allowed is THREE (3) Hours.This paper contains EIGHT (8) questionsCandidates must answer ALL EIGHT (8) questionsQuestions are not of equal marksWrite your answers to all applicable questions in the Blue Answer Book suppliedStudents may NOT remove any part of this question paper from the exam room.The exam paper will be made available on the University Library website.Page 2 of 9 COSQuestion 1 Design and DRY [8 marks]Assume you have to design a student registration system for an university. In this system,students are represented as instances of a class Student with several properties (id,firstName, lastName, dob). A desktop graphical user interface (GUI) for this application isprovided by the class StudentEditor, and instances of Student are stored as xmldocuments using a structure defined by the XML schema students.xsd.a) For this Kind of application, a design based on tiers (layers) is often used. Name thetiers (layers) you would here, and describe the dependencies between these tiers ![3 marks]b) At some stage, a new boolean attribute isExtramural must be added to the Studentclass. This will also require changes to the schema and the editor (form)StudentEditor (a new text field must be added). Discuss the DRY principle usingthis example, and which technologies can be used to facilitate this kind of change.[3 marks]c) Later, your client decides to change the application by providing a web-based userinterface. Using your answer to a) , describe the benefits of the tiered (layered)design to facilitate this.[2 marks]Page 3 of 9 COS1802/159.251 辅导、 写作Java课程编程、Java程序语言调试Question 2 Logging and Orthogonality [6 marks]a) Explain the concept of orthogonality using log4j loggers, levels and appenders as anexample! Discuss which language features in Java are used in order to achieveorthogonality in log4j ![4 marks]b) What will be printed on the console if the following script is executed?[2 marks]Logger logger = Logger.getLogger(mylogger);Appender appender = new ConsoleAppender(new SimpleLayout(),ConsoleAppender.SYSTEM_OUT);logger.AddAppender(appender);logger.setLevel(Level.ERROR);logger.error(error1);logger.info(info1);logger.Warn(warn1);logger.debug(debug1);logger.setLevel(Level.DEBUG);logger.error(error2);logger.info(info2);logger.setLevel(Level.INFO);logger.warn(warn2);logger.debug(debug2);Page 4 of 9 COSQuestion 3 Testing [8 marks]Assume you build a tax calculator library that has a method double distance(Point,Point)that computes the distance between two points in space. The algorithm used only worksfor points With non-negative coordinates, otherwise, an IllegalArgumentException isthrown.a) Lets assume you have created test cases for 1,000 different input values using aspreadsheet. All tests succeed, i.e., they calculate the expected value. Can youconclude from this that distance(Point,Point) is correctly implemented ?[2 marks]b) Describe how you would use junit features to efficiently implement such a largenumber of tests. Explain how this feature(s) works ![2 marks]c) The handling of negative input values is part of the specification of thedistance(Point,Point) method. How would you test this?[2 marks]d) An alternative to testing negative input values is to exclude them from all tests byadding a precondition that the input values must be non-negative. Which junitfeature can be used to implement this, and how does this work ?[2 marks]Page 5 of 9 COSQuestion 4 – Organising Code [4 marks]Explain the Advantages of convention over configuration using the Java getter and setterconvention !Page 6 of 9 COSQuestion 5 – Shell and Scripting [8 marks]a) In a shell session, when you enter the command:grep abc file.txtIt produces no output, indicating the command found no matches. How would youdetermine if the same command was successful in a shell script?[2 marks]b) What are environment variables used for? List some commonly used environmentvariables.[1 marks]c) With examples, explain the concepts of redirection and piping in the Unix shell.[3 marks]d) Permissions are used to control access to files. Describe the permissions for script.shin the following listing.[2 marks]cd ~ls -l-rw-rw-r– script.shPage 7 of 9 COSQuestion 6 – Source Code Management [8 marks]a) What is the purpose of using a linter such as Checkstyle or a code formatter (e.g.google-java-format) in collaborative software development?[1 mark]b) What is the key difference between an older version control system such as CVSand Git?[1 mark]c) A development team has released the first version of a software, tagged the releaseas v1 and it Has been built and shipped to a set of customers. The developers arenow working on features for version 2. Meanwhile, a customer reports a bug forversion 1.Explain how the developers would use Git (with git commands and commit graph)during development, and to contribute a bugfix for version 1 and also to apply thefix on version 2, release a patched version and ship to customer as v1.1 without thenewer features in v2[6 marks]Page 8 of 9 COSQuestion 7 – Issue Tracking and Licensing [4 marks]a) Describe how you would use an issue tracker in collaborative softwaredevelopment and What information it records and tracks.[3 marks]b) What is the main difference between permissive licenses such as the BSD/MITlicense and the GPL, a copyleft license?[1 marks]Page 9 of 9 COSQuestion 8 – Metrics [6 marks]a) Discuss how lines of code metrics can be misleading in assessing developerproductivity[2 marks]b) Define logical, physical lines of code and cyclomatic complexity. For the sortingmethod listed below in Java, calculate these metrics.[4 marks]public void bubbleSort(int[] arr) {boolean Swapped = true;int j = 0;int tmp;while (Swapped) {swapped = false;j++;for (int i = 0; i arr.length – j; i++) {if (arr[i] arr[i + 1]) {tmp = arr[i];arr[i] = arr[i + 1];arr[i + 1] = Tmp;swapped = true;}}}}+ + + + + + + +如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导