Gujarat Technological UniversitySummer 2023 Examination

GTU 3140705 Object Oriented Programming -I (Java) Summer 2023 Paper Solution & PDF

B.E. · Computer Engineering · Semester 4 · Subject Code: 3140705
Download Official GTU PDF
Share:
Total Marks70 MarksExternal theory exam
Passing Marks23 Marks33% minimum cutoff
Exam Duration2.5 Hours10:30 AM – 1:00 PM
Paper Structure5 QuestionsWith internal OR choices
Jump toQ1Q2Q3Q4Q5

Question 1

14 MarksMedium
(a)

What is the Java bytecode, and what is the extension of Java bytecode file? Which software is needed to run Java bytecode?

3 Marks
(b)

Describe syntax errors (compile errors), runtime errors, and logic errors by giving suitable examples?

4 Marks
(c)
Answer in brief (within 50 words):
IJustify Java enables high performance.
IIDifferentiate between while and do while loop?
IIIHow 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);
IVIf the value of variable x is 1 then what will be returned by the

following expression: x % 2 = = 0

7 Marks

Question 2

14 MarksMedium
(a)
What is the use of this keyword? How it is different from super keyword?
3 Marks
(b)
(
i)Given that Thing is a class, how many objects and how many reference 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); } }
4 Marks
(c)
Write a program that defines class named StopWatch. The class contains:
  • Private data fields startTime and endTime with getter methods. 07 • 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.
7 Marks
OR OPTION
(c)
Create a class called Employee that includes:
IThree instance variables— id (type String), name (type String) and monthly_salary (double).
IIA default constructor that initializes the three instance variables.
IIIA setter and a getter method for each instance variable (for example for id variable void setId(String id), String getId( )).
IVdisplayEmployee() 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.
7 Marks

Question 3

14 MarksMedium
(a)
Differentiate between checked and unchecked exception?
3 Marks
(b)
Exemplify throw and throws clause of exception handling?
4 Marks
(c)

Demonstrate use of try catch block by catching ArithmeticExceptions and InputMismatchExceptions?

7 Marks
OR OPTION
(a)
Describe thread life cycle with block diagram?
3 Marks
(b)

Differentiate between Thread class and Runnable interface for implementing Threads?

4 Marks
(c)

Write a program to make calculator that accepts input from commandline? Use java’s exception handling mechanism to handle abnormal situation?

7 Marks

Question 4

14 MarksMedium
(a)
Define Queue interface of java collection classes?
3 Marks
(b)
Explain types of polymorphism?
4 Marks
(c)

What are the differences between ArrayList and LinkedList? Demonstrates use of ArrayList with example?

7 Marks
OR OPTION
(a)
Define Object Serialization?
3 Marks
(b)
What are the differences between text I/O and binary I/O?
4 Marks
(c)
Describe and demonstrate Binary I/O classes of java?
7 Marks

Question 5

14 MarksMedium
(a)
Answer in one line:
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.
3 Marks
(b)
List JavaFX UI controls?
4 Marks
(c)

What do you understand by event source and event object? Explain how to register an event handler object and how to implement a handler interface?

7 Marks
OR OPTION
(a)
Enlist various Layout panes available in JavaFX?
3 Marks
(b)
Discuss JavaFX benefits?
4 Marks
(c)
Illustrate basic structure of JavaFX program?
7 Marks
College Exam Groups

Studying for Object Oriented Programming -I?

Circulate this solved paper with KaTeX formulas and 1-click AI step solvers to your batchmates on WhatsApp or Telegram.

About this Examination Paper & Attribution

Official Gujarat Technological University (GTU) examination paper and step-by-step solutions for Object Oriented Programming -I (Java) (Summer 2023, B.E. · Computer Engineering, Sem 4). Features complete 70-mark regular & remedial examination pattern, official marking distribution across all 5 questions, and direct 1-click official PDF download.

Transcribed for student exam preparation from Gujarat Technological University official examination archives. Questions, syllabus guidelines, and curriculum marking schemes remain the intellectual property of Gujarat Technological University.

Download PDF