// Anna University, Chennai / 2019
Anna University — Object Oriented Programming (CS8392), April/May 2019
Object Oriented Programming · CS8392 · R2017 · B.E. Computer Science and Engineering
Files open in a new tab. Use your browser's download or save option to keep a copy.
Work through the questions
16 questions
No verified answers are available for this paper.
Can a Java source file be saved using a name other than the class name? Justify.
No verified answer or solution is available for this question.
What are inline functions? Give examples.
No verified answer or solution is available for this question.
State the conditions for method overriding in Java.
No verified answer or solution is available for this question.
Write the syntax for importing packages in a Java source file and give an example.
No verified answer or solution is available for this question.
What happens when the statement: int value = 25/0; is executed?
No verified answer or solution is available for this question.
Give an example for reading data from files using File Input Stream.
No verified answer or solution is available for this question.
Sketch the lifecycle of a thread.
No verified answer or solution is available for this question.
Give the syntax of a generic class with an example.
No verified answer or solution is available for this question.
Write the class hierarchy for panel and frame.
No verified answer or solution is available for this question.
State the purpose of getRed( ), getBlue( ) and getGreen( ) methods.
No verified answer or solution is available for this question.
(a) (i) Discuss the three OOP principles in detail. (7) (ii) What are literals? Explain the types of literals supported by java. (6) (OR) (b) (i) Explain the selection statements in Java using suitable examples. (7) (ii) Write a Java code using do-while loop that counts down to 1 from 10 printing exactly ten lines of 'hello'. (6)
No verified answer or solution is available for this question.
(a) Explain hierarchical and multi-level inheritances supported by Java and demonstrate the execution order of constructors in these types. (13) (OR) (b) (i) Explain simple interfaces and nested interfaces with examples. (7) (ii) Present a detailed comparison between classes and interfaces. (6)
No verified answer or solution is available for this question.
(a) (i) Give an example for nested try statements in Java source file and explain. (7) (ii) Write a note on built-in exceptions. (6) (OR) (b) Create an IN file in Java to store the details of 100 students using a STUDENT class. Read the details from IN file, convert all the letters in IN file to lowercase letters and write it into OUT file. (13)
No verified answer or solution is available for this question.
(a) Describe the creation of a single thread and multiple threads using an example. (13) (OR) (b) (i) Using an example, explain inter-thread communication in Java. (7) (ii) Write a generic method for sorting an array of integer objects. (6)
No verified answer or solution is available for this question.
(a) (i) Use graphics objects to draw an arc and a semicircle inside a rectangular box. (4) (ii) Sketch the hierarchy of Java AWT classes and methods. Create a 'checkbox' using these classes and methods. (9) (OR) (b) (i) State the differences between AWT and swing. (4) (ii) Present the hierarchy of Java swing classes and methods of component class. Create a simple 'combo box' in Java swing using the classes and methods. (9)
No verified answer or solution is available for this question.
(a) The following is a system that can be used to synchronize threads. In some shops a machine issues numbered tickets to customers and customers are served in numeric order. * A ticket machine holds an integer, initially zero, and has a single atomic operation: turn( ) - which increments the integer and returns its previous value. * A scheduler also holds an integer, initially zero, and has two atomic operations: next( ) - which increments the integer count queue(value) - suspends the calling thread until the count is atleast as large as the value given as an argument Given a ticket machine, m, and a scheduler, s, a critical region could then be coded as follows: number = m.turn( ); s.queue(number); protected code s.next( ); Write Java classes Ticket Machine, with a turn method, and Scheduler, with next and queue methods to implement the system. (OR) (b) Define Java classes of your own without using any library classes to represent linked lists of integers. Provide it with methods that can be used to reverse a list and to append two lists.
No verified answer or solution is available for this question.