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

java pyqs

The document outlines a series of sessional tests for the MCA (Master of Computer Applications) program at Jamia Millia Islamia, focusing on Programming in Java. It includes various questions on Java concepts such as String handling, exception handling, collections, multithreading, and JDBC, requiring students to demonstrate their understanding through coding tasks and theoretical explanations. Each test consists of multiple questions, and students are instructed to attempt a specified number while providing concise and relevant answers.

Uploaded by

adnanansari7565
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)
26 views

java pyqs

The document outlines a series of sessional tests for the MCA (Master of Computer Applications) program at Jamia Millia Islamia, focusing on Programming in Java. It includes various questions on Java concepts such as String handling, exception handling, collections, multithreading, and JDBC, requiring students to demonstrate their understanding through coding tasks and theoretical explanations. Each test consists of multiple questions, and students are instructed to attempt a specified number while providing concise and relevant answers.

Uploaded by

adnanansari7565
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/ 6

DEPARTMENT OF COMPUTER SCIENCE

Jamia Millia islamia


SESSIONAL TEST - I
(Odd Semester, 2024-25)

Course: MCA (Sem-l) Title: CS-15 (Programming in Java)


Max. Marks: 20
Duration: 1 hour
Attempt any FOUR ofthe following questions.
relevant answers only.
All questions carry equal marks. Provide concise and

1. What is the difference between String, StringBuffer, and


StringBuilder in Java? Explain the purpose of he StringTokenizer
class and give an example of its usage.
2. What is the purpose of a try-catch block, and how does it work?
Explain the diference between checked and unchecked
exceptions in Java.
3. Create acustom exception class invalidAgeExcertion i Java. Ths
excepion shouid be thrown when a user enters an invaiid age
(e.g., less than 0or greater than 150) in a method that checks the
validity of age. Also write main method to test the working of this
CUstomexception class.
4. What is the purpose of generics in Java, and how do they improve
code reliatbility? What are the limitations of generics in Java?
5. What is the difference between ArrayList and LinkedList? Wite a
program to count the frequcncy of words in a sentence using
HashMap.
SESSIONAL TEST-!
Couse: MCA (Semester-I)
Duratiort: 1hour Subject: Programming with Java
Max. Marks: 20
Attempt all the questions. All questions Carry equal marks. Restrict to the relevant
answers only.
5. Suppose we need to cotIpue the area of different two dimensional shapes such as Circle,Square, Recialigie
and Triangle. Each shape should have its own classes., Desian classes inheitance hierarchy so that maxtnu
code reusability can be applied. Also write a tester program to test your classes.
6 What is the purpose of Collection Framework? Write a short note in legacy collections.
7. What is inter-process communication (PC)? How inter-thread communication is achieved in Java
programming. Write with code example.
8. Write short answers of the following questions in one/two sentence(s) only: (1x5=5)
vi. Purpose of Class.forName).
vii. Role of Slatement objects in JDBC.
vii. Purpose of synchronized keyword.
ix. What is a Daemon thread?
x. Purpose of throws keyword.
SCIENCE
DEPARTMENT OF COMPUTER
Jamia Milia Islarnia
SESSHONAL TEST -|
(0dd Semester, 2023-24)

Course: MCA (Sem -) Subject: CS15 (Programming with Java)


Deration:1 hour Max. Marks: 20

Aitempt any FUR of the folowing questions.


i questions cary equal marks. Restrict to the relevant answers only.
1. What are different Java White Paper buZZWords? Describe any three of
them.
2. What do you mean by Ragged Array? Write a Java
program to create a
Ragged Aray.
Imagine a Tolbcoth at a bridge. Cars passing by the booth are
to pay Rs. 100 toli. Mostly they do, but expected
sometimes a car goes by without
paying. The tolbocth keeps track of the number
and of the tctal amount of money of cars that have gone by,
collected.
Model this toilbooih with a clasS called
äre a tp i..t to inotd the
toial TollBooth The two data items
number of cars, and a type
hold the total amount of
these to zero. A money collected. A double to
car total and adds member function called constructor initializes both of
100 to the cash payingCar
total.
(0
increments the
nopayCar (), increments the car total but adds
total.
Another function, called
Finally, a member function called nothing to the cash
totals. Write a program to test display () displays the
4. Wite short this class. twO
answers of the following
(1x6-5)
i.
questions in one or two lines:
Explain the use of the finally
i. What is
the use of block.
Is main a JAVAP too?
iv. Why are the keyword in Java?
v. methods of the Math
Does Java support copy class static?
constructors destructors?
and
DEPARTMENT OF COMPUTER SCIENCE
Jamia Millia lslamia
SESSIONAL TEST-||
(Odd Semester, 2023-24)

Course: MCA (Sem-I) Subject: CS15 (Programming with Java)


Duration:1 hour Max. Marks: 20

Attempt any FOUR of the following questions.


Allquestions cary equal marks. Restrict to the relevant answers only.
1. What are the benefits of creating packages? Explain the role
of CLASSPATH environment variable with example.
2. Why is String class immutable? Differentiate between
operator and equals) method in context to comparing two
String objects.
3. What is the StringTokenizer class, and how is it used for
tokenizing strings in Java? Write a Java method to remove
all duplicate characters from a given string.
4. What is an ArrayList in Java, and how does it differ froma
regular array? Write a Java function to merge two sorted
ArrayLists of integers inio a single sorted ArrayList.
5. What is the nesd of exception handling in aprogramming
language? Write a Java program that demonstrates the use
of try-catch blocks to handle exceptions when dividing two
numbers. Handle both arithmetic exceptions and invalid
input.
Mid-Term 3rd Test
Progiallie: MCA (Java) Time: 1 Hour

Auenpl AL.L (he questions: (10x2=201:


Tie ad explain the use of wildcards in Java generics. Explain the concept of type
uunds il generic programming. Provide examples of using upper and lower bounds in
KiC methods or classes. Discuss scenarios where type bounds are essential for
tisullIg lvpe safety in generic code.

2. atue oiultithreading and JDBC in a Java program. Design a svenario where multiple
LwCurrently insert records into adatabase table. Iniplement a mechanism to
l : . l .ta Icons0stencies or conllivts during simultaneous insertions. Provide code
4lejplatations lor your solution.
Roll No...3MCA.Q3 O
Code: CA15
MCA (SEM-) EXAMINATION^ - 2023
Programming with Java
Time: 3 Hours Max Marks: 60
. Write your Roll No. on the top lmmediately on receipt of the question paper.
Attempt ALL questions by selccting any TWO parts. All questions carry equal marks.

1. (a) What is an array in Java? What is the purpose of the enhanced for loop when working
with arrays? Explain with example.
(b What classes are used to handle Blg Numbers in Java? How can you perform addition
of two Blginteger objects?
Write a Java program to find the average of elements in an integer array. The size and
(C)
values to be stored in the array need to be taken as input from the user.
2. (a) What is an interface? Define an interface called Shape that contains of methods to
calculate area and perimeter of a 2D shape.
(b) What do you mean by Super Cosmlc class in Java? Explain the purpose of
CLASSPATH environment variable?
(C) Defne a class Student in Java consisting of student!D, firstName, lastName, address,
city, moblle, emall with necessary parameterized constructors and getter methods. It
also has a method to print the data members. Dermonstrate the working of the class
in the main program.
3. (a What is the purpose of StringTokenizer class? Write a program to tokenize the words
of the serntence: "Java, Matlab, R, C+t, Google G0, Visual Basic" and store it in an
Array.
(b) What are the advantages of generic programming? Implement a generic method in
Java to find and return the maximum element in an array of any type (e.g., integers,
doubles, or strings).
(C) How is exception handling done In Java? Provide an example of a try-catch block.
Also explain the difference between checked and unchecked exceptions.
4. (a Explain the diference between the List and Set interlaces in the Java Collection.
Implement a program that uses the ArrayList class to store and manipulate a list of
user names.

(b) What is the purpose of the synchronized keyword in Java? Provide an example of its
usage in a multithreaded program.
(c) Write a Java program that demonstrates the use of multithreading by creating and
running two threads concurrently.
5. (a Explatn the purpose of the JPanel class in Swing. Provide an example where it is used
to organlze components.
(b) Explain the purpose of the DriverManager and Connection nterfaces/ in JDBC.
Implemernt a program that retrieves data from a database table and displays it.
(c) Write a GUI appllcation using swing to calculate the area of a triangle whOse all the
three sldes a, b, and c are taken as input through text box. The user-interface should
have approprlate swing components.

You might also like