Question Paper Code : 50900
B.E./B.Tech. DEGREE EXAMINATIONS, APRIL/MAY 2024.
Third/Fourth Semester
Computer Science and Engineering
CS 3391 — OBJECT ORIENTED PROGRAMMING
(Common to : Biomedical Engineering/Computer Science and Design/Computer Science and Engineering (Artificial Intelligence and Machine Learning)/Computer Science and Engineering (Cyber Security)/Computer and Communication Engineering/Medical Electronics/Computer Science and Business Systems/Information Technology)
(Regulations 2021)
Answer ALL questions.
PART A — (10 × 2 = 20 marks)
- 1.
List the features of Object Oriented Programming.
- 2.
Give an example for defining constant in Java.
- 3.
Mention the use of constructor overloading.
- 4.
Illustrate method overriding with an example.
- 5.
Why to handle exceptions?
- 6.
What is thread priority? How it can be set for a thread?
- 7.
Write any four methods associated with basic string class.
- 8.
What is a String Buffer Class?
- 9.
Why JAVAFX is preferred for building Internet applications?
- 10.
Write the constructors of HBox class.
PART B — (5 × 13 = 65 marks)
- 11.(a)
Discuss the various access specifiers in Java.
- Or
- (b)
Explain Java static members with examples.
- 12.(a)
With an example explain the use of Abstract classes in Java.
- Or
- (b)
What is user defined package? How to create and import a user defined package? Explain with example.
- 13.(a)
Discuss about user defined exceptions in Java. Give suitable example.
- Or
- (b)
How thread synchronization is managed in java. Write example code.
- 14.(a)
Write a Java program to read data from a file and to write data to a file.
- Or
- (b)
Discuss about Generic classes and Generic methods in Java.
- 15.(a)
With an example code explain how the key events are handled using JAVAFX.
- Or
- (b)
Write a Java program to illustrate the use of JAVAFX checkbox and choice box controls.
PART C — (1 × 15 = 15 marks)
- 16.(a)
Design a class called Ship that has the following members: - Name of the ship-string - Year-the year of the ship built in integer - A constructor, get and set methods - to String that displays the name of the ship and year. Extend a class CruiseShip from Ship with the following members: - Maximum number of passengers - integer - A constructor, get and set methods - To String method that overrides base class to display the name of the ship and number of passengers. Demonstrate the classes with ship array assigned with Ship and Cruise Ship objects and calling the respective to String method.
- Or
- (b)
A and B are any two players in a game which progresses by making alternate moves by the players. Assume the odd moves are played by the player A and the even moves are played by the player B. Define a class for generating the player move which implements runnable interface and ensures that the player is operated with lock. Implement using thread pool so that A and B will get only the alternate moves. The players can stop after making a total of 100 moves.