0% found this document useful (0 votes)
8 views4 pages

End Semester (2023)

Uploaded by

lalendrakumar170
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

End Semester (2023)

Uploaded by

lalendrakumar170
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

(MANIPAL

MANIPAL INSTITUTE
A constituent unit of MAHE,
OF TECHNOLOGY
Maniah
I|SEMESTER MCA
INTERNAL EXAMINATIONS MARCH 2023
TEST -1
SUBJECT: Java Programming (MCA 4253]
Date of Exam:
15/03/2023 Time of Exam: 10.30 AM- 11.30 AM Max, Marks: 15
Instructions to Candidates:
Answer ALL the questions & missing data may be
suitably assumed

1. List two uses of this


keyword in Java.
2. Write statements in java to break "Welcome to Java" into an array
tokens delimited by a space.
3 Differentiate between toString() and valueOf) methods of String class. 1
4 Given a method named void my method). Write java statements to
class. prevent it from being overridden by another 1
5. Differentiate between private and default access specifier. 1
6. What will be content of arr2 and arr3 after exccuting the following
statements. Justify your answer. 2
int[] arrl -(10,20, 30 ), arr2 =(35,40,45), arr3 - arrl;
arrl arr2; arrl[1] =7;
7. With the help of a suitable example, discuss the nced for variable-length arguments.
2
Given a set of 2D-points: (( xi, yi).(x2, y2 )..(Xa y )). ldentify the two points that are ncarest to each other 3
based on the minimum distance. Create a class called Points with ficlds (x cord &y cord) and use a static
method to perform the above task. Use an array of objects to store 'n' points entered by the user.
Note: The distance between two points (X1.y) and (x2.y2) is calculated as: /(x, -x)² + (y- y)
Sample Input: Eter the nunber d paints 4
Eterx-rd andy-cord far lh pairts Output: The dosest 2 pairts are(5,) &(6,6)
|-2
5
8
66
9. Department of Data Science and Computer Applications (DSCA) has three courses, namely, B.Tech DSE, 3
M.Tech DSE and MCA. After the conduction of first sessional test, the department staff neced to calculate cach
student's total of all the core subjects(consider 3 core subjects). Consider an abstract class DSCA with a method
totalMarks(). and sub-classes as BTech, MTech and MCA with each class holding data members as regno, name,
subl marks, sub2marks, sub3marks, course Name, and appropriate constructors. The total marks calculation for
cach course is as follows:
B.Tech- 50% of subl + 25% of sub2 + 25% of sub3,
M.Tech - 40% of subl +30% of sub2+ 30% of sub3
MCA- 409% of subl +30% of sub2 + 30% of sub3
The grade is caleulated as follows:
Total marks Range 90-100 80-89 70-79 60-69 50-59 40-49 <40

Grade A+ B D

Display
the above the total
scenario usingmarks andmethod
dynamic grade. Use an aray of objccts to process the results of 'n' students. Implement
dispatch.

Page 1 ofi
I| SEMESTER MCA INTERNAL EXAMINATIONS APRIL 2023
TEST-2
SUBJECT: Java Programming [MCA 4253]
Date of Exam: 19/04/2023 Time of Examn: 10.30 AM -11.30 AM Max. Marks: 15

Instructions to Candidates:
Answer ALL the questions & missing data may be suitably assumed
1. What are the access specifiers/modifier for fields and methods of an interface?

2. What will be the output of the following code? 1


class exception handling
public static void main (String args [U)

try
{ System. out.print ("Exception" +" *+ 1 / o) : )
catch (ArithmeticException e)
( System. out.print ("handled") : )

3 Differentiate between final and finally statements.


4. How do you check whether a thread is still running or not
5. Differentiate between checked and unchecked exceptions? 1

6. With the help of a suitable example, discuss the importance of thread join operation. 2

7. Assume that you are creating a class AAA with a method int abc). In the method abc0 you are invoking a 2
method void pqr) belonging to another class XYZ. Assume that in class XYZ it is mentioned that the method
Pgr Othrows two exceptions Eypl and Exp2. Write two kind of the code structure for class AAA to make use of
the method pqr).
8 Write a java program using interfaces to calculate Total on road payable price of acar along with some 3
accessory items. Assume we have two interfaces: on_ road price and accessoryprice. The interface
on road price is used to calculate Total on road price using car base price, road tax and insurance amount. The
interface accessory price calculates total price of accessories based on accessories fitted to the car and GST
tax(89%).
The road tax and insurance are calculated as 10% 4% of base price of car input by user.
The price information of accessories are as follows:
Infotainment: Rs 200.00, reverse camera: Rs 120.00, fog lamp: Rs 100.00.
Total on road payable price of acar =Total On road price +Total price of accessories with GST.
User may create an object passing base price and name of accessories required. Example: Objectl (2000.
"infotainment") or Object2 (3000, "infotainment", "ReverseCamera'")
Depending on the car base price &accessories selected calculate and display Total on road payable price of the
car.

9 Develop a multithreaded application by implementing Runnable interface to perform array operations as 3


follows:
MainThread: Read input elements from the keyboard and store them in an array, also display the count of
positive and negative numbers obtaincd from the following threads:
Thread-1: Display all the positive numbers present in the array.
Thread-2: Display all negative numbers present in the array.

Page I ofi
Reg. No.

MANIPAL INSTITUTE OF TECHNOLOGY


MANIPAL
(A constituent unit of MAHE, Manipal)
I|SEMESTER M.C.A
END SEMESTER EXAMINATIONS, MAY 2023
SUBJECT: JAVA PROGRAMMING [MCA 4253]
REVISED CREDIT SYSTEM
(31/05/2023)
MAX. MARKS: 50
Time: 9:30 am -12:30 pm
Instructions to Candidates:

Answer ALL the questions.


suitably assumed.
* Missing data may be
private instance fields for representing each customer's
1A. Create a class called Bank with parameterized constructor
balance amount. Provide a
name, age, account number and define a static method named getCustomerData()"
fields. Also
to initialize the instance taking input from the user and returns that object.
object by
which constructs a Bankdemonstrate this.
Write a main method to Explain with suitable examples
3
overloading and method overriding?
1B. What is method code snippet.
2

Differentiate between final and finalize using suitable


1C. 5
the total pollution fees (total p_fees) to get pollution
to calculate four wheelers
2A. Write ajava program pollution fee is calculated for two wheelersaandmethod float
certificate. The total PoluCerticate with
separately. Create an interface Two classes Two_wheeler and
age, VehiclePrice).
calc totalp_ fees(vehicle this interface to calculate totalp_fees as below
Four_ Wheeler implement Four-Wheelers
Two-Wheelers
Vehicle age P Fees% FitnessFees
Vehicle age P Fees% 500
0%
0.00%
1% 750
Ito 5
I to 5 0.50%
.5% 1000
1.00% 5 to 10
5 to 10 1250
>10 2.0%
>10 2.00%

p_fees = VehiclePrice* P Fees% (for two wheelers)


total %+FitnessFees (for four wheelers)
VehiclePrice* P Fees 3
total p_fees = by a user. The password must
validate a password entered
EB, Write a java program to
satisfy following criteria
Password must be of length 7 or more.
ii Password must contain at least one Capital letter. Page Iof?
MCA 4253
Password must contain any one of the spccial characters S, #, a
iii.
i) throws
With the help ofa suitable example, describe the keywords: i) throw
2
2C.
("Sunday""Monday",
3A. Create an arraylist and store strings representing seven days
arraylist by the first 3
, "Saturday"). Process the arraylist to replace each string of the
lettersof the same day("Sun","Mon",..."Sat'") and store the updated strings in the same
forward and backward directions
arraylist. Display the contents of the arraylist in the
using listiterator.
3B. Developa multithreaded application in java to perform the following operations: 3

and store them in an


Main thread: Read the email ids of 'n' students from the keyboard
array of strings.
Thread-I: Display all email ids ending with manipal.edu
Thread-2: Display all email ids ending with gmail.com 2
to dsipaly content of any object
3C. With an example, illustrate the usage of toString)
content.
itemID(integer), 5
that contains the fields:
4A. Create a class named ItemDetails field for the item's supplier,
Additionally, include a
item_name(string), price(double). "Supplier". The "Supplier" class should have
represented as an object of a class named
supplier ID (an integer), supplier name (a string), and supplier address (a
fields for the ItemDetails object using Cloneable
interface. Write a
string). Create a copy of the
to perform the above operation.
complete program with necessary methods user-defined
the help of a suitable example, explain the steps for handling
4B. With
exceptions. 2
java.
4C. Write a note on 'event-handling' in
unique 5
"Carlnfo" that stores information about a car, such as: its
5A) Create a class named (string), year of manufacture
name (string), manufacturer
identifier (integer), model
Implement the class with appropriate input and output
(integer), and price (float). to store the details of 'n' cars in a file called
methods. Use serialization calculate
information from the file "Car Details.txt" and
"Car Details.txt". Read the 3
the total cost of all
the cars.
random-access file numbers. txt and store 10 double
Write a program to create a
SB. operations:
values. Perform the following (in bytes).
Display total size of this file file.
data item in the
Add 100 to the 5th
at the end of the file.
ii.
Append a value: 32.5 tasks.
to implement the above
iii.
complete program 2
Write a records from a database table through JDBC
involved in accessing the
SC. List the steps
programming.

You might also like