Question Paper: Object Oriented Programming Using Java : Question Paper Dec 2016 - Computer Engineering (Semester 5) | Gujarat Technological University (GTU)
0

Object Oriented Programming Using Java - Dec 2016

Computer Engineering (Semester 5)

TOTAL MARKS: 100
TOTAL TIME: 3 HOURS
(1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks.
1(10) List two characteristics of an abstract class.(1 marks) 1(11) Write use of keyword import.(1 marks) 1(12) Explain ArrayList.(1 marks) 1(13) Explain multiplicity.(1 marks) 1(14) Explain association class.(1 marks) 1(2) The method main is a static method. Why?(1 marks) 1(3) Explain keyword this.(1 marks) 1(4) How do you interpret following statement? String []s;(1 marks) 1(5) Explain right-shift operators.(1 marks) 1(6) Write two usage of keyword super.(1 marks) 1(7) Describe use CLASSPATH.(1 marks) 1(8) Explain keyword volatile.(1 marks) 1(9) Explain method parselnt.(1 marks)


Short Questions

1(a) Explain role of JVM.(1 marks) 2(a) Compare String and String Buffer.(3 marks) 2(b) Explain keyword final by giving examples.(4 marks)


Solve any one question.Q2(c) &Q2(d)

2(c) Declare a class called Book having book title & author name as members. Create a sub-class of it, called BookDetails having members. Create a sub-class of it, called BookDetails having price & current stock of book as members. Create an array for storing details of n books. Define methods to acheive following:
Initialization of members
To query availability of a book by author name/book title
To update stock of a book on purchase and sell. Define method main to show usage of above methods.
(7 marks)
2(d) It is required to compute SPI(semester performance index) of n students of class for their registered subjects in a semester. Assume that all students register for 6 subjects and each subject carry 5 credits. Also, follow GTU covention and method for computation of SPI. Declare a class called student having following data members: id_no,
grades_obtained and spi. Define constructor,display and calculate_spi methods. Define main to process data of n students.
(7 marks)


solve any one question Q.3(a,b,c) &Q4(a,b,c)

3(a) Explain keywords private and protected.(3 marks) 3(b) Define a recursive method for computing x raised to power y by doing repetitive multipication where x and y are positive integer numbers. Define main to use above method.(4 marks) 3(c) It is required to maintain and process the status of total 9 resources. The status value is to be stored in an integer array of dimension 3×3. The valid status of a resource can be one of the followings.free: indicated by integer value 0 occupied: indicated by integer value 1 inaccessible: indicated by integer value 2 Declare a class called ResourcesStatus, having data member called statusRef, referring to a two dimensional array(3×3)of integers to be used to refer to the above mentioned status values integers to be used to refer to the above mentioned status values. Define a member method called processStatusCount that counts and displays total number of free resources, total number of occupied resources exceeds total number of inaccessible resources. The exception to be raised and handled if total number of occupied resources exceeds total number of free resources. The handler marks status of all inaccessible resources as free. Accept initial status values from command line arguments and initialize the array. Raise and handle user defined exception if invalid status value given.(7 marks) 4(a) Explain interface with help of example(s).(3 marks) 4(b) Write a method for computing first n terms of Fibonacci sequence. Define method main taking value of n as command line argument and calling the method.(4 marks) 4(c) Write a complete program to accept N integer numbers from the command line. Raise and handle exceptions for following cases:
when a number is -ve
when a number is evenly divisible by 10
when a number is greater than 1000 and less than 2000
when a number is greater than 7000 Skip the number if an exception is raised for it, otherwise add it to find total sum.
(7 marks)


solve any one question Q.5(a,b,c) &Q6(a,b,c)

5(a) Explain instance of operator.(3 marks) 5(b) Wrtie a multithreaded program to compute and print prime numbers up to n where n is given as command line argument Instantiate requited number of threads where each thread except the last, examines next 50 numbers and the last thread examines remaining numbers to check whether a number is a prime or not.(4 marks) 5(c) Write a complete program to read from console up to n lines or until "quit" is entered. The lines entered are displayed on the screen after reading all lines. The program also counts lines begining with character 'A' or 'E' as first letter.(7 marks) 6(a) Explain dynamic method dispatch by giving an example.(3 marks) 6(b) Write a complete multi threaded program to meet following requirement for producer-consumer threads:
Three threads-one producer and two consumers to be instantiated in the method main.
At a time, the producer produces one integer information along with consumer_id to represent id of a consumer that will consume produced information.
Information and consumer_id are stored in a shared buffer.
The information produced is to be consumed by appropriate consumer only, as specified by the producer.
The producer thread produces total 6 incformation.
(4 marks)
6(c) (i)Explain usage of class File Input Stream by giving an example.
ii) Explain Inet Address class and its one method.
(7 marks)


solve any one question Q.7(a,b,c) &Q8(a,b,c)

7(a) Explain Aggregation and Association.(3 marks) 7(b) Prepare a class model to describe undirected graph. An undirected graph consists of a set of vertices and a set of edges. Edges connect pairs of vertices. Your model should capture only structure of graph (i.e.connectivity) and need not be concerned with layout such as location of vertices or lengths of edges.(4 marks) 7(c) Explain activity diagram with the help of an example.(7 marks) 8(a) Explain Metadata with the help an example.(3 marks) 8(b) Construct state diagram for a telephone line.(4 marks) 8(c) Explain sequence diagram with the help of an example.(7 marks)

Please log in to add an answer.