0% found this document useful (0 votes)
4 views

CS 6308 Java Programming

The document outlines the structure and content of the B.E (FT) End Semester Examinations for Computer Science and Engineering, specifically for the Java Programming course. It includes objectives for learning Java fundamentals, object-oriented programming, UI creation, parallel programming, and web application development. The exam consists of multiple parts with various questions that assess students' understanding and application of Java concepts.

Uploaded by

UTHAYAKUMAR J
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

CS 6308 Java Programming

The document outlines the structure and content of the B.E (FT) End Semester Examinations for Computer Science and Engineering, specifically for the Java Programming course. It includes objectives for learning Java fundamentals, object-oriented programming, UI creation, parallel programming, and web application development. The exam consists of multiple parts with various questions that assess students' understanding and application of Java concepts.

Uploaded by

UTHAYAKUMAR J
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Roll No.

M I I I I

B.E (FT) END S E M E S T E R EXAMINATIONS - N O V / D E C 2023

Computer Science and Engineering


Fifth Semester
CS6308 - JAVA PROGRAMMING
(Regulation2018-RUSA)
Time : 3 Hours Answer A L L Questions Max. Marks : 100

COl To learn about the fundamentals of Java language constructs


C02 To familiarize the student with Object Oriented Programming in Java
COS To expose the student to creating U I
C04 To understand the concepts of parallel programming
COS To develop web applications with Java

Part - A (10 X 2 = 20 Marks)

SI Questions Marks CO BL
No.
1. Identify the errors in the following code: 2 COl L2
public int searchAccount( int[2S] number) {
number = newint[15];
for (int i = 0; i < number.length; i++) {
number[i] = number[i-l] + number[i+l];
}
return number;
}
2. Find out what is wrong in the following code? 2 C01,C02 LI
public class Test {
private int id;
public void m l ( ) {
this.id = 45;
}
public void m2() {
Test.id = 45;
}
}
3. Differentiate between overriding and overloading. 2 C01,C02 L2
4. What is the need for the layout managers? What is the 2 C01,C02 LS
defaultJayout manager for a frame? How can the component *

added to a frame?
5. Using the try-catch block, write a code fragment that opens 2 C01,C02 L4
a file "default.dat".
6. What are the different ways of implementing multithreading 2 C04, L2
in a Java program?
V

7. What is the role of Drivers in JDBC? 2 C02 LI


8. What is the advantage of implementing Comparator 2 C02 L2
interface in a class?
9. Write about the lifecycle of JSP. 2 COS LI
10. List the types of Java Web services. 2 COS LI

Part - B (8 X 8 = 64 Marks)
(Answer any 8 questions)
SI Questions Marks CO BL
No.
11 A teacher has five students who have taken four tests and COl L2,
the test scores are stored in 2D array. The following LS
grading scale is assigned to a student based on average of
his/her four tests.
Test Score Grade
90-100 A
80-89 B
70-79 C
60-69 D
0-S9 F

Write a program to print each student's average test score


and grade.
12 Define a class called Salesperson whose data members C01,C02 L2,
are: age(integer), name(String), number of sales(integer), LS
salary(double). The member functions are: constructor
with three arguments to initialise member variables age,
name and salary and number of sales is initialised always
initialised to zero, addSale(double saleAmount) - method
to increment the number of sales for the amount of sale
made, int getSales() - to return the sales made by the
Salesperson, displayO - to display the details of the
Salesperson, double getBonus() - to return the bonus of
Salesperson based on the following table:
Sales range Bonus amount
10-20 1000
20-40 2000
> 40 SOOO
Write a driver program to create object of Salesperson and
test all methods.
IS Design a class named Ticket with fields for holding C01,C02 L2,L3
category(char) - that takes value A, B and C,
ticketPriceA (double), ticketPriceB (double) and
ticketPrice_C (double). The methods are constructor with
arguments to initialise data fields and toString() to display
the details of Ticket.
Create a class named Concert, which extends the Ticket
class. The Concert class should have a field for a
totalScats(int) and the seat distribution for each category
is given by catA_seat(int), catB_seat(int) and
catC_seat(int).T]ie metliods are:
• Constructor with arguments
• void sell(char,int) - that decrements the total
number of seats and respective category seat
• void cancel(char,int) that increments the total
number of seats and respective category seat
• double calculateO - that returns the revenue
generated by sales of Ticket.
• toStringO - display the details of Concert.
Write a Test program to create objects of the classes and
invoke the methods of the classes.
14 Create a Conference Registration System as G U I C02 L2,L3
application that calculates the registration fees for a
conference. The general conference registration is Rs.895
per person and student registration is Rs. 495. There is an
optional keynote speech for Rs.300 per person. The

Workshop Fee(Rupees)
Network Security 295
Advanced Java 395
Programming
Spring Framework 495

The application should allow the user to select the


registration type, the optional keynote speech and as many
preconference workshop. The total cost should be
displayed.
15 Implement FileHandler class that contains write and read C03,C05 L2,L3
methods to read and write objects of Salesperson defined
in question 12.Write a main program that will print the
Salesperson who made maximum number of sales.
16 Write a Java program to display the message " Welcome to C02 L2,L3
Java Exam" using multiple threads with sleep interval of
100 ms'
17 Develop a Java program to create a Bank Account database C04 L2,L3
named BankDB. The BankDB database will have a table
named AcountHolder, with the following columns:
Column Name Data Type
Name Char (50)
Balance Double
Address Char(lOO)
Primary key
Account number Double
The table will contain 5 rows with various account bolder
details. Write a program that connects to the BankDB
database, and allows the user to perform the following
operations:
i. Sort the list of AccountHolder by balance, in
ascending order.
ii. Get the total amount in bank.

18 Create a class called PhoneBook that has fields 8 C02 L2,L3


name(String) and phone number(int). Define constructor
amd toStringO methods. Implement a driver program that
creates alteast five PhoneBook objects and stores in an
arraylist, the duplicate names(if any) in the arraylist should
be deleted and PhoneBook objects must be displayed.
19 Write a simple client/server application using socket 8 C05 L2,L3
programming. The client will send the amount and years
of the Fixed deposit to a server. The server receives the
data and produces the result. The result is sent to client
and the client displays it in console.
20 Write an applet that receives a name through a parameter 8 C02 L2,L3
and displays it with a "Hello" message.
21 Create an Interface Tax with method calculateTax and 8 C05 L2,L3
static variable tax initialised with value 0.15. Implement
this interface in class Salesperson defined in Q.no.l2.
Write a main program to print the SalesPerson who has
paid highest tax by implementing Comparator Interface.
22 List out the steps involved in creating a R M l application 8 COS L2,L3
with an example.

Part - Cr2 X 8 = 16 Marks)

SI No. Questions Marks CO BL


23. Write a simple generic version of method isEqualTo that compares its 6 C03 L2,L2
two arguments with the equals method and returns true if they're equal
and false otherwise. Use this generic method in a program that calls
isEqualTo with a variety of built-in types, such as Object or Integer
24. With respect to Q.no 13, write an exception class that can be 10 COl L2,L3
instantiated and thrown whenever a negative or zero is initialised as C02
Ticket's each category price. Wi;ite another exception class that can
be instantiated and thiown to validate the method seli() that the number
of seats sold doesnot exceed totalSeats. Demonstrate the exception
classes in a Java program.

(L1 - Remembering, L2 - Understanding, L3 - Applying, L4 - Analysing, L5 - Evaluating, L6 -


Creating)

You might also like