Vous êtes sur la page 1sur 3

VARDHAMAN COLLEGE OF ENGINEERING

(Autonomous)
Model Question Paper
Four Year B.Tech III SEMESTER Regular Examination
(Regulation VCE-R11)
Course Code: ACS11T04

OBJECT ORIENTED PROGRAMMING THROUGH JAVA


Time : 3Hours
Max mark : 75
Answer one question from each unit
All Questions carry equal marks.

Unit 1:
1. a. Discuss the features of java and how they differ in viewing world. (8 M)
b.Input a paragraph containing n number of sentences where (1 = < n <
4). The words are to be separated with a single blank space and are in
UPPERCASE. A sentence may be terminated either with a full stop . Or a
question mark ? only. Any other character may be ignored. Perform the
following operations:
i. Accept the number of sentences. If the number of sentences
exceeds the limit,
an appropriate error message must be displayed.
ii. Find the number of words in the whole paragraph.
2. a. Write a program to accept the names of 10 cities in a single dimension
string array and their STD codes in another single dimension integer array.
Search for a name of a city input by the user in the list. If found, display
search successful and print the name of the city along with its STD code,
or else display the message search unsuccessful, no such city in the list.
(8 M)
b. An array is initialized with n integers. You are required to write a java
program to locate all zeros in this array and shift them to the left.
Remember that the order of other numbers should not be change in the
array (7 M)
Unit 2:
3. a. Design a class to overload a function polygon() as follows
i.
void polygon(int n, char ch) : with one integer argument and
one character type argument that draws a filled square of side
n using the character stored in ch.
ii.
void polygon(int x, int y) : with two integer arguments that
draws a filled rectangle of length x and breadth y, using the
symbol @
iii.
void polygon() : with no argument that draws a filled triangle
shown below: (8M)

b .Write a program to create a class named shape. In this class we have


three sub classes circle, triangle and square each class has two member
function named draw () and erase (). Create these using polymorphism
concepts?
4. a. Create an abstract base class shape with two members base and
height, a member function for initialization and a function to compute
area ( ). Derive two specific classes Triangle and Rectangle which override
the function area ( ). Use these classes in a main function and display the
area of a triangle and a rectangle.
b. Write a program to make a package Balance in which has Account class
with Display_Balance method in it. Import Balance package in another
program to access Display_Balance method of Account class.
Unit 3:
5. a. Generate a user defined exception for a banking application.

b. On a single track two vehicles are running. As vehicles are going in


same direction there is no problem. If the vehicles are running in
different direction there is a chance of collision. To avoid collisions write a
Java program using exception handling. You are free to make necessary
assumptions.
.
6. a Write a complex program to illustrate how the thread priorities?
Imagine that the first thread has just begun to run, even before it has a
chance to do anything. Now comes the higher priority thread that wants to
run as well. Now the higher priority thread has to do its work before the
first thread starts.
b. Create five threads with different priorities. Send two threads of the
highest priority to sleep state. Check the aliveness of the threads and
mark which thread is long lasting.
Unit 4.
7. a. Write a Java program to design a Arithmetic calculation using AWT
Controls
b. Create a Bouncing of a Ball application in Java Program?
8. a. Create a program that displays the x and y position of the cursor
movement using Keyboard and Mouse Listeners.
b. Design a pendulum in applet and apply sleep method from a Thread
class where the pendulum must move for every 1sec.
Unit 5.
9. a. Create simply the banner is used to advertising for any institution,
shops and any organizations. Display the simple text rotation in a
rectangular area of the appropriate applet.
b. Write a Applet program that automatically display the text with Font
Style, Font type Using get Parameter Method.

10.a. Write the Java applet that contains a textbox for accepting Student Id
and
a
button
"View Details". Single click on the button will display the details of the
corresponding
Student (Name, Course, Semester and Address) in text boxes from a
database.
b. Create a JTable and JScrollPane object and add JScrollPane to table and
the argument to the constructor specify the table and policies for vertical
and horizontal scrollbar. Now add the scroll pane to the content pane of an
applet.

Vous aimerez peut-être aussi