PDF Google Drive Downloader v1.1


Report a problem

Content text 3140705 - OOP 2023W.pdf

1 Seat No.: ________ Enrolment No.___________ GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER–IV (NEW) EXAMINATION – WINTER 2023 Subject Code:3140705 Date:31-01-2024 Subject Name: Object Oriented Programming -I Time: 10:30 AM TO 01:00 PM Total Marks:70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. 4. Simple and non-programmable scientific calculators are allowed. MARKS Q.1 (a) How java supports platform independency? What is the role of JVM in it? 03 (b) Write a program which displays first n prime number? Where is n provided by user as command line argument? 04 (c) Write a program which declare integer array of 10 elements? Initialize array and define following methods with the specified header: (i) public static int add(int [] array) print addition of all element of array. (ii) public static int max(int [] array) print maximum element of array. (ii) public static int search(int [] array, int key) search element key in array and return index of it. If element is not found method will return -1. 07 Q.2 (a) Describe the relationship between an object and its defining class? 03 (b) Analyze following code. Validate and explain output of code. If any error exists, indicate portion. Suggest code to eliminate error: public class Circle { private double radius; public static void main(String args[]){ Circle c1=new Circle(2); System.out.println("Area "+c1.getArea()); B b1=new B(2, 2); System.out.println("Area "+b1.getArea()); } public Circle(double radius) { radius = radius; } public double getRadius() { return radius; } public double getArea() { return radius * radius * Math.PI; } } class B extends Circle { private double length; B(){} B(double radius, double length) { length = length; } public double getArea() { return (super.getArea() * length); } } 04 (c) Design a java class Rectangle which contains following field and methods: (i) Field: length, width: int (ii) Default Constructor: initialize all fields with 0 value (iii) Method: int getArea() will return area of rectangle. 07
2 OR (c) Answer in brief(within two lines): (i) If a method defined in a subclass has the same signature as a method in its superclass with the same return type, is the method overridden or overloaded? (ii) How do you invoke an overridden superclass method from a subclass? (iii) What is the purpose of "this" keyword? (iv) Differentiate between following statements: int a=3; Integer b=new Integer(3); (v) Which java keyword is used to prevent inheritance (prevent class to be extended)? (vi) Can we create reference of interface. If we can create, then what is the use of it? (vii) What is the difference between a String in Java and String in C/C++? 07 Q.3 (a) Discuss benefits of multithreading? 03 (b) Develop a program which stores name of districts in Gujrat in array of String. The array specified capacity to store 5 districts. The user will be able to print name of district based on array index e.g. (0 will print Ahemdabad). If the specified index is out of bounds, program will display the message Out of Bounds. 04 (c) Characterize the two ways of implementing thread in Java? Illustrate each method by example? 07 OR Q.3 (a) Explain the use of finally. Show the type of code usually kept in finally? 03 (b) Distinguish unchecked exception and checked exception? Give example of each type of exception? 04 (c) Implement java code to take some (say 10) Strings from users. Put all the input Strings in an array (String name[]). Provide implementation of following methods: (i)search(String s) will return index of String passed in method if String S is found in name, otherwise return -1. (ii)sort() will print sorted String array to user 07 Q.4 (a) Write a program to find out whether the given number is palindrome or not? 03 (b) Outline the use of throw in exception handling with example. 04 (c) Give Definitions: static, finalize, final 07 OR Q.4 (a) Elaborate the role of java garbage collector. 03 (b) State four similarities between Interfaces and Classes. 04 (c) Differentiate between ArrayList and LinkedList? Which list should you use to insert and delete elements at the beginning of a list? What methods are in LinkedList but not in ArrayList? 07 Q.5 (a) List various classes for Binary Input Output? 03 (b) Characterize the role of Iterator interface? 04 (c) Explain DataInputStream and DataOutputStream Classes? Implement a java program to demonstrate any one of them? 07 OR Q.5 (a) What do you understand by JavaFX? How it is different from AWT? 03 (b) Explain ArrayList Class with its methods? 04 (c) Design and develop EMI Calculator using JavaFX? The user will enter a loan amount, annual interest 07
3 rate, and number of years and click the Calculate button to get EMI and total payment ? formula is EMI= P*r*(1+r)n /((1+r)n -1) P is Principal Loan Amount r is rate of interest calculated on monthly basis. (i.e., r = Rate of Annual interest/12/100. If rate of interest is 10.5% per annum, then r = 10.5/12/100=0.00875) n is loan term / tenure / duration in number of months? ***********

Related document

x
Report download errors
Report content



Download file quality is faulty:
Full name:
Email:
Comment
If you encounter an error, problem, .. or have any questions during the download process, please leave a comment below. Thank you.