[go: up one dir, main page]

0% found this document useful (0 votes)
57 views2 pages

Gujarat Technological University

Uploaded by

axat dudhat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views2 pages

Gujarat Technological University

Uploaded by

axat dudhat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Seat No.: ________ Enrolment No.

___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– IV(NEW) EXAMINATION – SUMMER 2023
Subject Code:3140705 Date:25-07-2023
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) What is the Java bytecode, and what is the extension of Java bytecode file? 03
Which software is needed to run Java bytecode?
(b) Describe syntax errors (compile errors), runtime errors, and logic errors by 04
giving suitable examples?
(c) Answer in brief (within 50 words): 07
I. Justify Java enables high performance.
II. Differentiate between while and do while loop?
III. How many times is the println statement executed?
for (int i = 0; i < 10; i++)
for (int j = 0; j < i; j++)
System.out.println(i * j);
IV. If the value of variable x is 1 then what will be returned by the
following expression:
x%2==0
Q.2 (a) What is the use of this keyword? How it is different from super keyword? 03
(b) (i) Given that Thing is a class, how many objects and how many reference 04
variables are created by the following code?
Thing item, stuff;
item = new Thing();
Thing entity = new Thing();
(ii) Examine following code. Write and justify output.
public class MyClass {
public static void main(String[] args) {
C c = new C();
System.out.println(c.max(12, 29));
}
}
class A {
int max(int x, int y) { if (x>y) return x; else return y; }
}
class B extends A{
int max(int x, int y) { return super.max(y, x) - 10; }
}
class C extends B {
int max(int x, int y) { return super.max(x+10, y+2); }
}
(c) Write a program that defines class named StopWatch. The class contains: 07
• Private data fields startTime and endTime with getter methods.
1
• no-arg constructor that initializes startTime with the current time.
• A method named start() that resets the startTime to the current time.
• A method named stop() that sets the endTime to the current time.
• A method named getElapsedTime() that returns the elapsed time for
the stopwatch in milliseconds.
• Declare object of StopWatch to demonstrate stop watch.
Hint: Use System.currentTimeMillis() to get current time in milliseconds.
OR
(c) Create a class called Employee that includes: 07
I. Three instance variables— id (type String), name (type String) and
monthly_salary (double).
II. A default constructor that initializes the three instance variables.
III. A setter and a getter method for each instance variable (for example
for id variable void setId(String id), String getId( )).
IV. displayEmployee() method for displaying employee details.
Write a driver class named EmployeeTest that demonstrates class Employee’s
capabilities. Create two Employee objects and display each object’s yearly
salary. Then give each Employee a 10% raise and display each Employee’s
yearly salary again.

Q.3 (a) Differentiate between checked and unchecked exception? 03


(b) Exemplify throw and throws clause of exception handling? 04
(c) Demonstrate use of try catch block by catching ArithmeticExceptions and 07
InputMismatchExceptions?
OR
Q.3 (a) Describe thread life cycle with block diagram? 03
(b) Differentiate between Thread class and Runnable interface for implementing 04
Threads?
(c) Write a program to make calculator that accepts input from commandline? 07
Use java’s exception handling mechanism to handle abnormal situation?

Q.4 (a) Define Queue interface of java collection classes? 03


(b) Explain types of polymorphism? 04
(c) What are the differences between ArrayList and LinkedList? Demonstrates 07
use of ArrayList with example?
OR
Q.4 (a) Define Object Serialization? 03
(b) What are the differences between text I/O and binary I/O? 04
(c) Describe and demonstrate Binary I/O classes of java? 07

Q.5 (a) Answer in one line: 03


(i) Write the name of package in which all collection classes and interface are
grouped.
(ii) Write the name of collection interface or abstract class which store and
process object in a first-in, first-out fashion.
(iii) Write the name of method that checks whether the collection contains the
specified element.
(b) List JavaFX UI controls? 04
(c) What do you understand by event source and event object? Explain how to 07
register an event handler object and how to implement a handler interface?
OR
Q.5 (a) Enlist various Layout panes available in JavaFX? 03
(b) Discuss JavaFX benefits? 04
(c) Illustrate basic structure of JavaFX program? 07
*************
2

You might also like