首页 > > 详细

讲解EE417留学生、讲解Web Application、Java编程语言调试、辅导Java讲解Python程序|讲解R语言编程


QUESTION 4 [TOTAL MARKS: 15]

Write the SQL to build three tables to represent your student registration record at Dublin City University. This database should record three main elements:

1)Biographical information (e.g. name, email etc.)
2)Registration on annual programmes
3)Registration on modules linked to those programmes
(8 marks)

Using the resulting tables generated by your SQL:

i)Demonstrate a multi-table join statement (2 marks)

ii)Explain the DELETE rules you have applied to your foreign key relationships (3 marks)

iii)Provide an SQL example that would violate referential integrity. Briefly explain why this violation occurs. (2 marks)

Answer to Question 4:

2 Marks for general create table statements
2 Marks for proper primary keys
4 Marks for proper linkages between tables and foreign keys

i) 2 Marks for multi-table join using their tables
ii) 3 Marks for strong explanation of why they chose the delete rules they did
iii) 2 Marks for proper example of violating referential integrity and provided explanation

QUESTION 5 [TOTAL MARKS: 8]
The following class ‘StringCheck.java’ will compare two strings A and B and check whether the string B is a substring of string A.


public class StringCheck {

public static void main(String[] args) {
String a = "LongerWordContainingOtherWords";
String b= "Word";
if (args.length==2) {
a = args[0];
b = args[1];
}
System.out.println(isASubstring(a, b)); // true
}

public static boolean isASubstring(String a, String b) {
return a.contains(b);
}
}

Write a unit test class ‘MyTest.java’ which will contain four unique test methods, two of which will be successful and two of which will fail.
Note: TestRunner.java and a template class for your unit tests can be found here (http://ee417.eeng.dcu.ie/course-content/section-x-testing)

Answer to Question 5:

1 Mark for each test written (4 Marks total)
2 Marks for appropriate tests chosen
2 Marks for correct and working code across the board

QUESTION 6 [TOTAL MARKS: 7]
Modify StringCheck.java from Question 5 so that it passes all of your previous tests, is robust against any submitted inputs and is case insensitive.

Answer to Question 6:

7 Marks for code that satisfies the tests above to at least include testing for either value being null and blank values.

This would typically be achieved by adding in exception catching to handle each of the scenarios. For example, a.contains(b) will throw a NullPointerException if a is null, so this would need to be fixed.

Nominally, fully working code should be executable and testable.

QUESTION 7 – 16 Multiple Choice [TOTAL MARKS: 20]

Automatically marked. 100% for the correct answer. 0% for incorrect answer. No negative marking applied.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!