Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

National Institute of Business Management

School of Computing and Engineering


BSc (Hons) Computing|ITB |EHNS-Year 1
Diploma in Software Engineering–21.2F
Diploma in Computer System Design -21.2F
Enterprise Application Development-1
Time Allowed: Three Hours 29th August 2022|9AM-12PM
INSTRUCTIONS TO CANDIDATES

• This paper contains 5 questions.


• Marks for each question is indicated.
• This is a closed book examination.
• Answer ALL questions.

ADDITIONAL MATERIALS

• None

Question 01[20 Marks]


A. Differentiate class and interface used in java programming. consider three points for
differentiation. (3 Marks)
B. Write sample codes to create an interface with the following members. The interface and its
members should be relevant. (5 Marks)
Members : A static variable
A default method
A static method
C. Differentiate usage of public class and non-public class. (2 Marks)
D. List out five built-in packages and one class from each package. (5 Marks)
E. Consider below import statement. Write codes to implement the package and class mentioned in
the import statement. (5 Marks)

import product.Device;

Page 1 of 5
Question 02[20 Marks]

A. Briefly explain why exception handling is crucial in enterprise application development.


(3 Marks)
B. Consider the following program codes and answer questions given.

try{
String mytext=null; // statement 1
System.out.println(mytext.length()); //statement 2
}
catch(ArithmeticException ex)
{ System.out.println(ex.getMessage());
}

I. What is the expected exception generated by statements? (2 Marks)


II. Do you think the exception is handled? If it is yes, write your justification. If it is not,
rewrite it. (3 Marks)
III. What it is the exception type (checked or unchecked) generated by the program? Briefly
justify it. (2 Marks)

C. You are required to write a java thread application to store characters of a string given in an array
and output the reverse of the string. The thread should sleep 1000 milliseconds once characters
are stored in the array. It is required to set the name and priority of the thread. (10 Marks)

Page 2 of 5
Question 03[20 Marks]

A. You are required to consider below string created. Write outputs of below string operations from
I to V.

String string1=new String(“AbCdRgW”).

I. string1.charAt(3);
II. string1.replace(1,”L”);
III. string1.equals(“AbCdRgw”);
IV. string1.toUpperCase();
V. string1.indexOf(“W”) (5 Marks)

B. Write a java program to write a set of characters in a string to a text file. (5 Marks)

C. Write a java application to store temperatures and names of 10 cities in Sri Lanka using Map
interface and output names of the cities whose temperatures exceed 35(Celsius). (5 Marks)

D. Write a lambda expression to execute the method in interface student. It should output students’
details received to parameters. (5 Marks)

Interface: Student

Method: Public void displayStudentDetails(String id,int first_name,int age);

Page 3 of 5
Question 04[20 Marks]
A. What is an event in programming? (3 Marks)
B. Why are event listeners required to handle events in java programming? (3 Marks)
C. List four event classes and relevant listeners. (4 Marks)
D. The following screen is a part of the Banking Application. You are required to write an event
handling program to output the interest rate based on the loan type and loan amount when the
button “calculate” is clicked by the user. (10 Marks)
Information:
Loan Type Annual Interest Rate
Housing 8%
Vehicle 12%
Personnel 6%

Screen:

Page 4 of 5
Question 05[20 Marks]
A. Write a java class to create and return database connection to following mentioned database.
(5 Marks)
Database Name : TMS
Username : pest
Password : wtrq#123

B. You are required to write a java program to accept employee Id and Employee Grade given by
user and record them in the table below. User response should be given once record is submitted.
Assume the table is created in above database. (10 Marks)

Screen:

Table Name: EmployeeGrade


Field Name Field Type
Employee Id Number
Employee Grade Text

C. Briefly explain the way of applying MVC design pattern to execute above scenario. You may
use diagrams if required. (5 Marks)

END of the Paper

Page 5 of 5

You might also like