0% found this document useful (0 votes)
83 views46 pages

(OOP) (APY Material) - Merged - Merged

The document outlines the syllabus for a Bachelor of Engineering course on Object Oriented Programming - I at Gujarat Technological University. It includes course rationale, teaching and examination schemes, detailed content topics, course outcomes, and a list of experiments. Additionally, it provides reference books and instructions for the examination format.

Uploaded by

Sazedur Rahman
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)
83 views46 pages

(OOP) (APY Material) - Merged - Merged

The document outlines the syllabus for a Bachelor of Engineering course on Object Oriented Programming - I at Gujarat Technological University. It includes course rationale, teaching and examination schemes, detailed content topics, course outcomes, and a list of experiments. Additionally, it provides reference books and instructions for the examination format.

Uploaded by

Sazedur Rahman
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/ 46

GUJARAT TECHNOLOGICAL UNIVERSITY

Bachelor of Engineering
Subject Code: 3140705
Semester – IV
Subject Name: Object Oriented Programming -I
Type of course: core course

Prerequisite: None

Rationale: Object oriented Programming has become a fundamental part of software development. OOP
facilitates Reuse of code, flexibility, effective problem solving. It provides a modular structure for programs
and implementation details are hidden. Reuse of code lowers the cost of development.

Teaching and Examination Scheme:

Teaching Scheme Credits Examination Marks Total


L T P C Theory Marks Practical Marks Marks
ESE (E) PA (M) ESE (V) PA (I)
4 0 2 5 70 30 30 20 150

Content:

Sr. No. Content Total


Hrs

1 Introduction to java and elementary programming: 4


Java language specification API, JDK and IDE, Creating, compiling and Executing a
simple java program, Programming style, documentation and errors, Reading input from
console, identifiers and variables, Assignment statements, Named constants and naming
conventions, Data Types (Numeric, Boolean, Character, String) its Operations and
Literals, Evaluating Expressions and operator Precedence, Types of Operators (Augmented
assignment, Increment and Decrement, Logical), operator precedence and associativity,
numeric type conversions.
2 Selections , Mathematical functions and loops: 4
If statements, Two way, Nested if and multi-way if statements, Switch statements,
Conditional Expressions, Common mathematical functions ,While , do-while and for loop,
nested loops, Keyword break and continue.
3 Methods and Arrays: 6
Defining and calling method, Passing argument by values, Overloading methods and scope
of variables, Method abstraction and stepwise refinement, Single Dimensional arrays,
copying arrays ,Passing and returning array from method, Searching and sorting arrays
and the Array class, Two-Dimensional array and its processing, Passing Two-dimensional
Array to methods, Multidimensional Arrays.
4 Objects and Classes: 4
Defining classes for objects, Constructors, accessing objects via reference variable, using
classes from the java library, static variables, constants and methods, visibility modifiers
and Data field encapsulation, passing objects to methods, array of objects, immutable
Page 1 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705
objects and classes, scope of variable and the this reference.

5 Object oriented thinking: 5


Class abstraction and Encapsulation, thinking in objects and class relationships, Primitive
data type and wrapper class types, Big integer and Big decimal class, string class, String
Builder and String Buffer class, super class and subclass, using super keyword, overriding
and overloading methods, polymorphism and dynamic binding, casting objects and
instanceof operator, The ArrayList class and its methods, The protected data and methods.
6 Exception Handling, I/O, abstract classes and interfaces: 4
Exception types, finally clause, rethrowing Exceptions, chained exceptions, defining
custom exception classes, file class and its input and output, Reading data from web,
Abstract classes, interfaces, Comparable and Cloneabal interface.
7 JAVAFX basics and Event-driven programming and animations: 5
Basic structure of JAVAFX program, Panes, UI control and shapes, Property binding, the
Color and the Font class, the Image and Image-View class, layout panes and shapes,
Events and Events sources, Registering Handlers and Handling Events, Inner classes,
anonymous inner class handlers, mouse and key events, listeners for observable objects,
animation
8 JAVAFX UI controls and multimedia: 4
Labeled and Label, button, Checkbox, RadioButton, Textfield, TextArea, Combo Box,
ListView, Scrollbar, Slider, Video and Audio.
9 Binary I/O ,Recursion and Generics: 4
Text I/O, binary I/O, Binary I/O classes, Object I/o, Random Access files, Problem solving
using Recursion, Recursive Helper methods, Tail Recursion, Defining Generic classes and
interfaces, Generic methods, Raw types and backward compatibility, wildcard Generic
types, Erasure and Restrictions on Generics.
10 List, Stacks, Queues and Priority Queues: 4
Collection, Iterators, Lists, The Comparator interface, static methods for list and
collections, Vector and Stack classes, Queues and priority Queues.
11 Sets and Maps: 2
Comparing the performance of Sets and Lists, singleton and unmodifiable collections and
Maps.
12 Concurrency 2
Thread states and life cycle,Creating and Executing threads with the Executor
Framework, Thread synchronization

Suggested Specification table with Marks (Theory): (For BE only)

Distribution of Theory Marks

R Level U Level A Level N Level E Level C Level


10 50 10 - - -

Legends: R: Remembrance; U: Understanding; A: Application, N: Analyze and E: Evaluate C:


Create and above Levels (Revised Bloom’s Taxonomy)

Page 2 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705

Note: This specification table shall be treated as a general guideline for students and teachers. The actual
distribution of marks in the question paper may vary slightly from above table.

Reference Books:

1) Intro to Java Programming, 10th edition, Y.Daniel Liang, Pearson

2) Object oriented programming with Java , Rajkumar Buyya,S Thamarai Selvi, Xingchen Chu,
McGrawHill

3) Programming in Java, Sachin Malhotra, Saurabh Choudhary, Oxford

4) Programming with JAVA , E Balagurusamy, McGrawHill

5) CORE JAVA volume -I Cay Horstmann, Pearson

Course Outcomes:

Sr. CO statement Marks % weightage


No.

CO-1 Use various Java constructs, features and libraries for simple problems. 20

CO-2 Demonstrate how to define and use classes, interfaces, create objects and 20
methods, how to override and overload methods, compile and execute
programs.

CO-3 Write a program using exception handling, multithreading with 20


synchronization.

CO-4 Write a program using Files, binary I/O, collection Frameworks for a 30
given problem.

CO-5 Design and develop GUI based applications in a group using modern 10
tools and frameworks.

List of Experiments:

(1) Write a Program that displays Welcome to Java, Learning Java Now and Programming is fun.

Page 3 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705
Write a program that solves the following equation and displays the value x and y:
(2) 1) 3.4x+50.2y=44.5 2) 2.1x+.55y=5.9 (Assume Cramer’s rule to solve equation
ax+by=e x=ed-bf/ad-bc
cx+dy=f y=af-ec/ad-bc )
(3) Write a program that reads a number in meters, converts it to feet, and displays the result.

Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your
(4) weight in kilograms and dividing by the square of your height in meters. Write a program that
prompts the user to enter a weight in pounds and height in inches and displays the BMI.
Note:- 1 pound=.45359237 Kg and 1 inch=.0254 meters.
(5) Write a program that prompts the user to enter three integers and display the integers in decreasing
order.
(6) Write a program that prompts the user to enter a letter and check whether a letter is a vowel or
constant.
(7) Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write a
program to generate a plate number.
(8) Write a program that reads an integer and displays all its smallest factors in increasing order. For
example if input number is 120, the output should be as follows:2,2,2,3,5.
Write a method with following method header.
(9)
public static int gcd(int num1, int num2)
Write a program that prompts the user to enter two integers and compute the gcd of two integers.
(10) Write a test program that prompts the user to enter ten numbers, invoke a method to reverse the
numbers, display the numbers.
(11) Write a program that generate 6*6 two-dimensional matrix, filled with 0’s and 1’s , display the
matrix, check every raw and column have an odd number’s of 1’s.
(12) Write a program that creates a Random object with seed 1000 and displays the first 100 random
integers between 1 and 49 using the NextInt (49) method.
Write a program for calculator to accept an expression as a string in which the operands and
(13)
operator are separated by zero or more spaces.
For ex: 3+4 and 3 + 4 are acceptable expressions.
Write a program that creates an Array List and adds a Loan object , a Date object , a string, and a
(14)
Circle object to the list, and use a loop to display all elements in the list by invoking the object’s to
String() method.
Write the bin2Dec (string binary String) method to convert a binary string into a decimal number.
(15)
Implement the bin2Dec method to throw a NumberFormatException if the string is not a binary
string.
Write a program that prompts the user to enter a decimal number and displays the number in a
(16) fraction.
Hint: Read the decimal number as a string, extract the integer part and fractional part from the
string.
(17) Write a program that displays a tic-tac-toe board. A cell may be X, O, or empty. What to display at
each cell is randomly decided. The X and O are images in the files X.gif and O.gif.
(18) Write a program that moves a circle up, down, left or right using arrow keys.

(19) Write a program that displays the color of a circle as red when the mouse button is pressed and as
blue when the mouse button is released.
Page 4 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705
(20) Write a GUI program that use button to move the message to the left and right and use the radio
button to change the color for the message displayed.
Write a program to create a file name 123.txt, if it does not exist. Append a new data to it if it
(21)
already exist. write 150 integers created randomly into the file using Text I/O. Integers are
separated by space.
(22) Write a recursive method that returns the smallest integer in an array. Write a test program that
prompts the user to enter an integer and display its product.
(23) Write a generic method that returns the minimum elements in a two dimensional array.

(24) Define MYPriorityQueue class that extends Priority Queue to implement the Cloneable interface
and implement the clone() method to clone a priority queue.
(25) Write a program that reads words from a text file and displays all the nonduplicate words in
descending order.The text file is passed as a command-line argument.

Major Equipment:

Computer, Laptop

List of Open Source Software/learning website:

https://www.tutorialspoint.com/java/

https://www.javatpoint.com/java-programs

Page 5 of 5

w.e.f. AY 2018-19
Enrolment No./Seat No_______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – SUMMER 2024
Subject Code:3140705 Date:08-07-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) Answer in one word:(one mark for each) 03
I. Which integral type in Java has the exact range from -
2147483648 (-231) to 2147483647 (231-1).
II. The software for developing and running Java
programs.
III. It is similar to machine instructions but is
architecture neutral and can run on any platform that has
a Java Virtual Machine (JVM).
(b) Write a program that reads an integer and adds all the 04
digits in the integer. For example, if an integer is 932, the
sum of all its digits is 14.
Hint: Use the % operator to extract digits, and use the /
operator to remove the extracted digit. For instance, 932
% 10 = 2 and 932 / 10 = 93.

(c) Analyze following code pieces (assume they are properly 07


enclosed in class and main function) and write the
output/error (No justification is required): (one mark for
each)
I. int num = 5;
int x = 1;
for (int i = 1; i <= num; i++) {
x *= i;
}
System.out.println("x is " + x);

II. int[] nums = {1, 5, 3, 9, 7};

int m= 1;
int s= 0;
for (int i = 0; i < nums.length; i++) {
if (nums[i] > m) {
s = m;
m = nums[i];
} else if (nums[i] > s && nums[i] != m) {
s = nums[i];
}
}
System.out.println("s is: " + s);

P
A
G
III. int i=1,j=0,k=0;
if (i > k) {
if (j > k)
System.out.println("i and j are greater than k");
}
else
System.out.println("i is less than or equal to k");
IV. int x = 3, y = 3;
switch (x + 3) {
case 6: y = 1;
default: y += 1;
}
System.out.println("y is " + y);
V. class HelloWorld {
public static void main(String[] args) {
int[] numbers = new int[1];
numbers[0]=0;
m(numbers);
System.out.println("numbers[0] is" +
numbers[0]);
}
public static void m(int[] y) {
y[0] = 3;
}
}
VI. StringBuffer s1 = new StringBuffer("Complete");
s1.setCharAt(1,'i');
s1.setCharAt(7,'d');
System.out.println(s1);
VII. int Integer = 24;
char String ='I';
System.out.print(Integer);
System.out.print(String);

Q.2 (a) Describe the relationship between an object and its 03


defining class.
(b) Write java statements for following class: 04
public class Counter {
int c;
}
i. Declare a parameterized constructor to initialize
variable c.
ii. Declare instance method to increment c and return
updated value of c.

(c) Justify following: 07


i. In general, constructors should be public.
ii. Why main is declared as static.
iii. Why we do not declare destructors in java.
iv. There is no pointer in java.
OR
(c) Differentiate between following: 07
i. this keyword vs super keyword
ii. abstract class vs interface
Q.3 (a) Give definition of method overloading. 03

P
A
G
(b) i. Analyze following code pieces and write the 04
output/error and briefly justify output:
public class Test {
public static void main(String[] args) {
new Person().printPerson();
new Student().printPerson();
}
}

class Student extends Person {


@Override
public String getInfo() {
return "Student";
}
}

class Person {
public String getInfo() {
return "Person";
}

public void printPerson() {


System.out.println(getInfo());
}
}
ii. Given the following source code, which comment line
can be uncommented without introducing errors?
abstract class MyClass {
abstract void f();
final void g() {}
//final void h() {} // comment (1)
}
final class MyOtherClass extends MyClass {
public static void main(String[] args) {
MyClass mc = new MyOtherClass();
}
void f() {}
void h() {}
//void g() {} // comment (2)
}

(c) Discuss public, private, protected and default access 07


modifiers with examples.
OR
Q.3 (a) What is the final keyword? Give different uses of the final 03
keyword.
(b) Declare an interface called Function that has a method 04
named evaluate that takes an int parameter and returns an
int value.
Create a class called Half that implements the Function
interface. The implementation of the method evaluate()
should return the value obtained by dividing
the int argument by 2.
(c) What is an Exception? Explain Exception handling in 07
JAVA with the help of example.

P
A
G
Q.4 (a) How do keyword throw differ from throws in Exception 03
handling?
(b) Differentiate between a byte oriented and a character- 04
oriented stream.
(c) Explain binary I/O classes. Demonstrate java file I/O with 07
any I/O class to read a text file.
OR
Q.4 (a) Compare JavaFX with Swing and AWT. 03
(b) i. List any four UI controls in JavaFX. 04
ii. List any two Panes for Containing and Organizing
Nodes
(c) Write a program to demonstrate GUI application 07
development using JavaFX.
Q.5 (a) What are the differences between ArrayList and 03
LinkedList? Which list should you use to insert and delete
elements at the beginning of a list?
(b) What is Java Collection Framework? List four collection 04
classes?
(c) Give the name of class or interface that provides following 07
facility (Do not elaborate)(one mark for each)
i. Dynamic array to store the duplicate element of different
data types. It maintains the insertion order.
ii. Implements the last-in-first-out data structure.
iii. Implements the first-in-first-out data structure.
iv. Implements the first-in-first-out data structure and it
holds the elements or objects which are to be processed by
their priorities.
v. It represents the unordered set of elements which
doesn't allow us to store the duplicate items.
vi. It is a red-black tree-based implementation. It provides
an efficient means of storing key-value pairs in sorted
order.
vii. It allows us to store key and value pair, where keys
should be unique.
OR
Q.5 (a) Explain thread life cycle. 03
(b) What is the package? Explain steps to create a package 04
with example.
(c) Declare a class called Employee having employee_Id and 07
employee_Name as members.
Extend class Employee to have a subclass called
SalariedEmployee having designation and
monthly_salary as members. Define following:
- Required constructors
- Methods to insert, update and display all details of
employees.
- Method main for creating an array for storing these
details given as command line arguments and showing
usage of above methods.

***********

P
A
G
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
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 04
by user as command line argument?
(c) Write a program which declare integer array of 10 elements? Initialize array 07
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.

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 04
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);
}
}
(c) Design a java class Rectangle which contains following field and methods: 07
(i) Field: length, width: int
(ii) Default Constructor: initialize all fields with 0 value
(iii) Method: int getArea() will return area of rectangle.

1
OR
(c) Answer in brief(within two lines): 07
(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++?

Q.3 (a) Discuss benefits of multithreading? 03


(b) Develop a program which stores name of districts in Gujrat in array of String. 04
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.
(c) Characterize the two ways of implementing thread in Java? Illustrate each 07
method by example?
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 04
each type of exception?
(c) Implement java code to take some (say 10) Strings from users. Put all the 07
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

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 07
to insert and delete elements at the beginning of a list? What methods are in
LinkedList but not in ArrayList?

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 07
program to demonstrate any one of them?
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 07
amount, annual interest
2
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?

***********

3
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV(NEW) EXAMINATION – WINTER 2022
Subject Code:3140705 Date:20-12-2022
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) Discuss significance of byte code. 03
(b) Explain Java garbage collection mechanism. 04
(c) List OOP characteristics and describe inheritance with examples. 07

Q.2 (a) Explain constructor with the help of an example. 03


(b) List out different methods available for String class in java and explain 04
any two with proper example.
(c) Explain all access modifiers and their visibility as class members. 07
OR
(c) Compare String with StringBuffer. Also, write a program to count the 07
occurrence of a character in a string.

Q.3 (a) What is the final class? Why they are used? 03
(b) Write exception handling mechanisms in JAVA. 04
(c) Explain Overloading and Overriding with example. 07
OR
Q.3 (a) How can you create packages in Java? 03
(b) What is Inheritance? List out the different forms of Inheritance and 04
explain any one with example.
(c) Explain the words super, static, final and this with the help of an 07
example.

Q.4 (a) List out various layout panes in JavaFX. 03


(b) Explain the architecture of JavaFX. 04
(c) Discuss BufferedInputStream and BufferedOutputStream classes with 07
an example.
OR
Q.4 (a) List out JavaFX UI controls and explain any one in detail. 03
(b) Demonstrate animation effect in JavaFX. 04
(c) Create a class called Student. Write a student manager program to 07
manipulate the student information from files by using FileInputStream
and FileOutputStream.

Q.5 (a) What is Java Collection? 03


(b) List out methods of Iterator and explain it. 04
(c) Explain Set and Map in Java with example. 07
OR
Q.5 (a) What is Vector class? 03
(b) Describe with diagram the life cycle of Thread. 04
(c) Explain synchronization in Thread with suitable example. 07
***********
1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – SUMMER 2022
Subject Code:3140705 Date:08-07-2022
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) List out features of Java. Explain any two features. 3
(b) Write a single program which demonstrates the usage of following 4
keywords:
i) import, ii) new, iii) this, iv) break, v) continue
Show how to compile and run the program in java.
(c) Demonstrate use of try-catch construct in case of hierarchical 7
Exception Handling. (i.e handling various exception belongs to the
exception hierarchy)

Q.2 (a) Explain following Java keywords using appropriate examples: 3


i) static, ii) final, iii) super
(b) Consider class A as the parent of class B. Explain among the 4
following which statement will show the compilation error.
i) A a = new A();
ii) A a = new B();
iii) B b = new A();
iv) B b = new B();
(c) Write a java program to take infix expressions and convert it into 7
prefix expressions.
OR
(c) Write a java program that evaluates a math expression given in string 7
form from command line arguments.

Q.3 (a) Defines types of inheritance. 3


(b) Explain the following constructors using appropriate example: 4
i) Default constructor and Parameterised constructor
ii) Shallow copy and Deep copy constructor
(c) Explain file io using byte stream with appropriate example. 7
hint: use FileInputStream, FileOutputStream
OR
Q.3 (a) Define types of polymorphism 3
(b) Explain the following: 4
i) Arguments and Parameters of a function
ii) Pass by Value and Pass by reference
1
(c) Explain file io using character stream with appropriate example. 7
hint: use FileReader, FileWriter

Q.4 (a) Define Encapsulation and access specifier 3


(b) Explain multithreading using Thread class 4
(c) Write a short note on Java Collections. 7
OR
Q.4 (a) Differentiate between Abstract class and Interfaces 3
(b) Explain multithreading using Runnable interface 4
(c) Write a program to add input elements in ArrayList collection class, 7
then sort the inserted elements in descending order and display the
sorted output.
hint: use Collections.reverseOrder()

Q.5 (a) Explain following Java keywords using appropriate examples: 3


i) throw, ii) throws, iii) finally
(b) In multi-threading using Thread class, explain with an example how 4
a start() method call invokes the run method of the class extending
Thread class.
(c) Write a short note on JAVAFX controls. 7
OR
Q.5 (a) Explain thread life cycle 3
(b) In multi-threads using the Runnable interface, explain with an 4
example how a start() method calls the run() method of a class
implementing a runnable interface.
(c) Develop a GUI based application using JAVAFX controls. 7

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – WINTER 2021
Subject Code:3140705 Date:05/01/2022
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 are syntax errors (compile errors), runtime errors, and logic 03
errors?
(b) What is Type Casting? Explain widening and narrowing type 04
casting.
(c) Explain Data Types in detail with example. 07

Q.2 (a) What is an interface? Explain with example. 03


(b) Explain “Passing argument by values” with example. 04
(c) Explain File class with its methods. 07
OR
(c) What is polymorphism? Explain dynamic binding with example. 07
Q.3 (a) Explain abstract class with example. 03
(b) Explain Method Overloading and Overriding. 04
(c) Write a program that counts the number of words in a text file. 07
The file name is passed as a command line argument. The words
in the file are separated by white space characters.
OR
Q.3 (a) Differentiate String class and StringBuffer class. 03
(b) Explain following keywords 04
(1) super (2) this
(c) Write a program that illustrates interface inheritance. Interface P 07
is extended by P1 and P2. Interface P12 inherits from both P1 and
P2. Each interface declares one constant and one method. class Q
implements P12. Instantiate Q and invoke each of its methods.
Each method displays one of the constants.
Q.4 (a) Explain visibility modifiers. 03
(b) Explain following controls 04
(1) Checkbox (2) Radio Button (3) Textfield (4) Label
(c) What is an Exception? Explain try, catch and finally with 07
example.
OR
Q.4 (a) What is the keyword “throw” used for? What is the keyword 03
“throws” used for?
(b) What is constructor? Explain constructor overloading. 04
(c) Explain different layout panes used in JavaFX. 07
Q.5 (a) Differentiate Text I/O and Binary I/O 03
(b) Explain Inner class with example. 04
(c) What is thread? Describe the complete life cycle of thread. 07
OR

1
Q.5 (a) Compare List and Set. 03
(b) Explain static variable and static method with example. 04
(c) Explain Thread Synchronization with example. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–IV (NEW) EXAMINATION – WINTER 2020
Subject Code:3140705 Date:24/02/2021
Subject Name:Object Oriented Programming -I
Time:02:30 PM TO 04:30 PM Total Marks:56
Instructions:
1. Attempt any FOUR questions out of EIGHT questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What is the difference between oop and procedural oriented language? 03
(b) Explain type-conversion in java. 04
(c) Explain class and object with respect to java. 07

Q.2 (a) Difference between Nested if and multi-way if statements. 03


(b) What is constructor overloading? 04
(c) What are the data-types and operators available in Java? 07

Q.3 (a) Explain access modifiers with Example. 03


(b) Explain following keywords 04
1) Static 2) Super
(c) Differentiate between final, finally and finalize. What will happen if we make 07
class and method as final?

Q.4 (a) Explain abstract class with example. 03


(b) Explain Primitive data type and wrapper class data types. 04
(c) Write a program to rise and handle divide by zero exception. 07

Q.5 (a) Explain mouse and key event handler in JavaFX. 03


(b) Explain following controls 04
1) text-Area 2) scrollbar 3) checkbox 4) combo-box
(c) Write a method for computing xy doing repetitive multiplication. X and y are 07
of type integer and are to be given as command line arguments. Raise and
handle exception(s) for invalid values of x and y.

Q.6 (a) Explain following classes in JavaFX. 03


1) Color class 2) font class 3) Image and image view class
(b) What is Exception? Demonstrate how you can handle different types of 04
exception separately.
(c) List and explain available type of constructors in java with example. 07

Q.7 (a) Differentiate Text I/O and Binary I/O. 03


(b) Explain usage of class FileInputStream and FileOutputStream by giving an 04
example.
(c) Explain Comparable and Cloneable interface. 07

Q.8 (a) What is Collection? Explain list, stack, queue classes. 03


(b) How to access object via reference variable? Explain with example. 04
(c) What do you understand by thread? Describe the complete life cycle of 07
thread.

*************

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – SUMMER 2021
Subject Code:3140705 Date:11/09/2021
Subject Name:Object Oriented Programming -I
Time:02:30 PM TO 05: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) Define object oriented concepts. 03
(b) What is the difference between the StringBuffer and StringBuilder 04
classes?
(c) Define constructor. How objects are constructed? Explain constructor 07
overloading with an example.

Q.2 (a) Explain about arrays, Type of arrays and arrays methods. 03
(b) Explain about Encapsulation, Abstraction. 04
(c) State the design hints for class and inheritance. 07
Also discuss the working and meaning of the “static” modifier with
suitable examples.
OR
(c) Explain in detail how inheritance and polymorphism are supported in 07
java with necessary examples.
Q.3 (a) Explain about different types of string methods. 03
(b) Write short notes on access specifiers and modifiers in java. 04
(c) What is an Exception? Explain the exception hierarchy. Explain how 07
to throw, catch and handle Exceptions.
OR
Q.3 (a) Explain about Final class, Fields, Methods. 03
(b) What is a Package? What are the benefits of using packages? Write 04
down the steps in creating a package and using it in a java program
with an example.
(c) Explain the concept of inner classes and explain the types of inner 07
classes with an example program.
Q.4 (a) What is Dynamic binding? Show with an example how dynamic 03
binding works.
(b) Write short notes about I/O stream classes. 04
(c) Explain the thread state, thread properties and thread synchronization. 07
OR
Q.4 (a) Explain the concept of finalization. 03
(b) What is reflection and how does it help to manipulate java code. 04
(c) Write a java program to implement the multiple inheritance concepts 07
for calculating area of circle and square.
Q.5 (a) Explain about callback 03
(b) Explain the interface with an example program. 04
(c) What is Generic programming and why is it needed? Explain with 07
example. List the limitations and restrictions of generic programming
1
OR
Q.5 (a) Explain about Proxy class, Interface and Methods. 03
(b) Explain about adapter classes and mouse events with an example. 04
(c) With a neat diagram explain the Model view controller design pattern 07
and list out the advantages and disadvantages of using it in designing
an application.

*************

2
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER– IV EXAMINATION – SUMMER 2020
Subject Code: 3140705 Date:26/10/2020
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.
MARKS
Q.1 (a) Explain JRE, JDK and JIT. 03
(b) Explain static keyword with example. 04
(c) Explain inheritance with its types and give suitable example. 07

Q.2 (a) Compare object-oriented programming with sequential programming. 03


(b) Method main is a public static method. Justify 04
(c) Write a program, which shows an example of function overloading. 07
Also, differentiate between function overloading and overriding.
OR
(c) Write a program to take string input as command line argument. In 07
addition, count occurrence of each character in a given string.
Q.3 (a) Write difference between String class and StringBuffer class. 03
(b) Explain super keyword with example. 04
(c) Describe abstract class called Shape, which has three subclasses say 07
Triangle, Rectangle, and Circle. Define one method area() in the abstract
class and override this area() in these three subclasses to calculate for
specific object i.e. area() of Triangle subclass should calculate area of
triangle likewise for Rectangle and Circle.
OR
Q.3 (a) How can we protect sub class to override the method of super class? 03
Explain with example.
(b) Define Interface and explain how it differs from the class. 04
(c) What do you mean by run time polymorphism? Write a program to 07
demonstrate run time polymorphism.
Q.4 (a) Differentiate between Text I/O and Binary I/O. 03
(b) Explain ArrayList class. 04
(c) What is an Exception? List out various built-in exceptions in JAVA and 07
explain any one Exception class with suitable example.
OR
Q.4 (a) How do you declare a generic type in a class? Explain. 03
(b) Write a JAVA program to read student.txt file and display the content. 04
(c) Explain Thread life cycle in detail. Write a program to create a child 07
thread to print integer numbers 1 to 10.
Q.5 (a) Explain in brief: Color class and its methods. 03
(b) What method do you use to obtain an element in the collection from an 04
iterator? Explain with example.
(c) Enlist various layout panes and explain any two in detail. 07
OR
Q.5 (a) Compare Set and List interfaces. 03
(b) Write importance of JAVAFX compare to AWT and Swing. 04
(c) How do you create a Scene object? How do you set a scene in a stage? 07
Is it possible to create multiple scenes? Write a program to place a circle
in the scene and fill circle with red color.

1
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER– IV EXAMINATION – SUMMER 2020
Subject Code: 3140705 Date:26/10/2020
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.
MARKS
Q.1 (a) Explain JRE, JDK and JIT. 03
(b) Explain static keyword with example. 04
(c) Explain inheritance with its types and give suitable example. 07

Q.2 (a) Compare object-oriented programming with sequential programming. 03


(b) Method main is a public static method. Justify 04
(c) Write a program, which shows an example of function overloading. 07
Also, differentiate between function overloading and overriding.
OR
(c) Write a program to take string input as command line argument. In 07
addition, count occurrence of each character in a given string.
Q.3 (a) Write difference between String class and StringBuffer class. 03
(b) Explain super keyword with example. 04
(c) Describe abstract class called Shape, which has three subclasses say 07
Triangle, Rectangle, and Circle. Define one method area() in the abstract
class and override this area() in these three subclasses to calculate for
specific object i.e. area() of Triangle subclass should calculate area of
triangle likewise for Rectangle and Circle.
OR
Q.3 (a) How can we protect sub class to override the method of super class? 03
Explain with example.
(b) Define Interface and explain how it differs from the class. 04
(c) What do you mean by run time polymorphism? Write a program to 07
demonstrate run time polymorphism.
Q.4 (a) Differentiate between Text I/O and Binary I/O. 03
(b) Explain ArrayList class. 04
(c) What is an Exception? List out various built-in exceptions in JAVA and 07
explain any one Exception class with suitable example.
OR
Q.4 (a) How do you declare a generic type in a class? Explain. 03
(b) Write a JAVA program to read student.txt file and display the content. 04
(c) Explain Thread life cycle in detail. Write a program to create a child 07
thread to print integer numbers 1 to 10.
Q.5 (a) Explain in brief: Color class and its methods. 03
(b) What method do you use to obtain an element in the collection from an 04
iterator? Explain with example.
(c) Enlist various layout panes and explain any two in detail. 07
OR
Q.5 (a) Compare Set and List interfaces. 03
(b) Write importance of JAVAFX compare to AWT and Swing. 04
(c) How do you create a Scene object? How do you set a scene in a stage? 07
Is it possible to create multiple scenes? Write a program to place a circle
in the scene and fill circle with red color.

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–IV (NEW) EXAMINATION – WINTER 2020
Subject Code:3140705 Date:24/02/2021
Subject Name:Object Oriented Programming -I
Time:02:30 PM TO 04:30 PM Total Marks:56
Instructions:
1. Attempt any FOUR questions out of EIGHT questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What is the difference between oop and procedural oriented language? 03
(b) Explain type-conversion in java. 04
(c) Explain class and object with respect to java. 07

Q.2 (a) Difference between Nested if and multi-way if statements. 03


(b) What is constructor overloading? 04
(c) What are the data-types and operators available in Java? 07

Q.3 (a) Explain access modifiers with Example. 03


(b) Explain following keywords 04
1) Static 2) Super
(c) Differentiate between final, finally and finalize. What will happen if we make 07
class and method as final?

Q.4 (a) Explain abstract class with example. 03


(b) Explain Primitive data type and wrapper class data types. 04
(c) Write a program to rise and handle divide by zero exception. 07

Q.5 (a) Explain mouse and key event handler in JavaFX. 03


(b) Explain following controls 04
1) text-Area 2) scrollbar 3) checkbox 4) combo-box
(c) Write a method for computing xy doing repetitive multiplication. X and y are 07
of type integer and are to be given as command line arguments. Raise and
handle exception(s) for invalid values of x and y.

Q.6 (a) Explain following classes in JavaFX. 03


1) Color class 2) font class 3) Image and image view class
(b) What is Exception? Demonstrate how you can handle different types of 04
exception separately.
(c) List and explain available type of constructors in java with example. 07

Q.7 (a) Differentiate Text I/O and Binary I/O. 03


(b) Explain usage of class FileInputStream and FileOutputStream by giving an 04
example.
(c) Explain Comparable and Cloneable interface. 07

Q.8 (a) What is Collection? Explain list, stack, queue classes. 03


(b) How to access object via reference variable? Explain with example. 04
(c) What do you understand by thread? Describe the complete life cycle of 07
thread.

*************

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – SUMMER 2021
Subject Code:3140705 Date:11/09/2021
Subject Name:Object Oriented Programming -I
Time:02:30 PM TO 05: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) Define object oriented concepts. 03
(b) What is the difference between the StringBuffer and StringBuilder 04
classes?
(c) Define constructor. How objects are constructed? Explain constructor 07
overloading with an example.

Q.2 (a) Explain about arrays, Type of arrays and arrays methods. 03
(b) Explain about Encapsulation, Abstraction. 04
(c) State the design hints for class and inheritance. 07
Also discuss the working and meaning of the “static” modifier with
suitable examples.
OR
(c) Explain in detail how inheritance and polymorphism are supported in 07
java with necessary examples.
Q.3 (a) Explain about different types of string methods. 03
(b) Write short notes on access specifiers and modifiers in java. 04
(c) What is an Exception? Explain the exception hierarchy. Explain how 07
to throw, catch and handle Exceptions.
OR
Q.3 (a) Explain about Final class, Fields, Methods. 03
(b) What is a Package? What are the benefits of using packages? Write 04
down the steps in creating a package and using it in a java program
with an example.
(c) Explain the concept of inner classes and explain the types of inner 07
classes with an example program.
Q.4 (a) What is Dynamic binding? Show with an example how dynamic 03
binding works.
(b) Write short notes about I/O stream classes. 04
(c) Explain the thread state, thread properties and thread synchronization. 07
OR
Q.4 (a) Explain the concept of finalization. 03
(b) What is reflection and how does it help to manipulate java code. 04
(c) Write a java program to implement the multiple inheritance concepts 07
for calculating area of circle and square.
Q.5 (a) Explain about callback 03
(b) Explain the interface with an example program. 04
(c) What is Generic programming and why is it needed? Explain with 07
example. List the limitations and restrictions of generic programming
1
OR
Q.5 (a) Explain about Proxy class, Interface and Methods. 03
(b) Explain about adapter classes and mouse events with an example. 04
(c) With a neat diagram explain the Model view controller design pattern 07
and list out the advantages and disadvantages of using it in designing
an application.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – WINTER 2021
Subject Code:3140705 Date:05/01/2022
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 are syntax errors (compile errors), runtime errors, and logic 03
errors?
(b) What is Type Casting? Explain widening and narrowing type 04
casting.
(c) Explain Data Types in detail with example. 07

Q.2 (a) What is an interface? Explain with example. 03


(b) Explain “Passing argument by values” with example. 04
(c) Explain File class with its methods. 07
OR
(c) What is polymorphism? Explain dynamic binding with example. 07
Q.3 (a) Explain abstract class with example. 03
(b) Explain Method Overloading and Overriding. 04
(c) Write a program that counts the number of words in a text file. 07
The file name is passed as a command line argument. The words
in the file are separated by white space characters.
OR
Q.3 (a) Differentiate String class and StringBuffer class. 03
(b) Explain following keywords 04
(1) super (2) this
(c) Write a program that illustrates interface inheritance. Interface P 07
is extended by P1 and P2. Interface P12 inherits from both P1 and
P2. Each interface declares one constant and one method. class Q
implements P12. Instantiate Q and invoke each of its methods.
Each method displays one of the constants.
Q.4 (a) Explain visibility modifiers. 03
(b) Explain following controls 04
(1) Checkbox (2) Radio Button (3) Textfield (4) Label
(c) What is an Exception? Explain try, catch and finally with 07
example.
OR
Q.4 (a) What is the keyword “throw” used for? What is the keyword 03
“throws” used for?
(b) What is constructor? Explain constructor overloading. 04
(c) Explain different layout panes used in JavaFX. 07
Q.5 (a) Differentiate Text I/O and Binary I/O 03
(b) Explain Inner class with example. 04
(c) What is thread? Describe the complete life cycle of thread. 07
OR

1
Q.5 (a) Compare List and Set. 03
(b) Explain static variable and static method with example. 04
(c) Explain Thread Synchronization with example. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – SUMMER 2022
Subject Code:3140705 Date:08-07-2022
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) List out features of Java. Explain any two features. 3
(b) Write a single program which demonstrates the usage of following 4
keywords:
i) import, ii) new, iii) this, iv) break, v) continue
Show how to compile and run the program in java.
(c) Demonstrate use of try-catch construct in case of hierarchical 7
Exception Handling. (i.e handling various exception belongs to the
exception hierarchy)

Q.2 (a) Explain following Java keywords using appropriate examples: 3


i) static, ii) final, iii) super
(b) Consider class A as the parent of class B. Explain among the 4
following which statement will show the compilation error.
i) A a = new A();
ii) A a = new B();
iii) B b = new A();
iv) B b = new B();
(c) Write a java program to take infix expressions and convert it into 7
prefix expressions.
OR
(c) Write a java program that evaluates a math expression given in string 7
form from command line arguments.

Q.3 (a) Defines types of inheritance. 3


(b) Explain the following constructors using appropriate example: 4
i) Default constructor and Parameterised constructor
ii) Shallow copy and Deep copy constructor
(c) Explain file io using byte stream with appropriate example. 7
hint: use FileInputStream, FileOutputStream
OR
Q.3 (a) Define types of polymorphism 3
(b) Explain the following: 4
i) Arguments and Parameters of a function
ii) Pass by Value and Pass by reference
1
(c) Explain file io using character stream with appropriate example. 7
hint: use FileReader, FileWriter

Q.4 (a) Define Encapsulation and access specifier 3


(b) Explain multithreading using Thread class 4
(c) Write a short note on Java Collections. 7
OR
Q.4 (a) Differentiate between Abstract class and Interfaces 3
(b) Explain multithreading using Runnable interface 4
(c) Write a program to add input elements in ArrayList collection class, 7
then sort the inserted elements in descending order and display the
sorted output.
hint: use Collections.reverseOrder()

Q.5 (a) Explain following Java keywords using appropriate examples: 3


i) throw, ii) throws, iii) finally
(b) In multi-threading using Thread class, explain with an example how 4
a start() method call invokes the run method of the class extending
Thread class.
(c) Write a short note on JAVAFX controls. 7
OR
Q.5 (a) Explain thread life cycle 3
(b) In multi-threads using the Runnable interface, explain with an 4
example how a start() method calls the run() method of a class
implementing a runnable interface.
(c) Develop a GUI based application using JAVAFX controls. 7

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV(NEW) EXAMINATION – WINTER 2022
Subject Code:3140705 Date:20-12-2022
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) Discuss significance of byte code. 03
(b) Explain Java garbage collection mechanism. 04
(c) List OOP characteristics and describe inheritance with examples. 07

Q.2 (a) Explain constructor with the help of an example. 03


(b) List out different methods available for String class in java and explain 04
any two with proper example.
(c) Explain all access modifiers and their visibility as class members. 07
OR
(c) Compare String with StringBuffer. Also, write a program to count the 07
occurrence of a character in a string.

Q.3 (a) What is the final class? Why they are used? 03
(b) Write exception handling mechanisms in JAVA. 04
(c) Explain Overloading and Overriding with example. 07
OR
Q.3 (a) How can you create packages in Java? 03
(b) What is Inheritance? List out the different forms of Inheritance and 04
explain any one with example.
(c) Explain the words super, static, final and this with the help of an 07
example.

Q.4 (a) List out various layout panes in JavaFX. 03


(b) Explain the architecture of JavaFX. 04
(c) Discuss BufferedInputStream and BufferedOutputStream classes with 07
an example.
OR
Q.4 (a) List out JavaFX UI controls and explain any one in detail. 03
(b) Demonstrate animation effect in JavaFX. 04
(c) Create a class called Student. Write a student manager program to 07
manipulate the student information from files by using FileInputStream
and FileOutputStream.

Q.5 (a) What is Java Collection? 03


(b) List out methods of Iterator and explain it. 04
(c) Explain Set and Map in Java with example. 07
OR
Q.5 (a) What is Vector class? 03
(b) Describe with diagram the life cycle of Thread. 04
(c) Explain synchronization in Thread with suitable example. 07
***********
1
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
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 04
by user as command line argument?
(c) Write a program which declare integer array of 10 elements? Initialize array 07
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.

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 04
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);
}
}
(c) Design a java class Rectangle which contains following field and methods: 07
(i) Field: length, width: int
(ii) Default Constructor: initialize all fields with 0 value
(iii) Method: int getArea() will return area of rectangle.

1
OR
(c) Answer in brief(within two lines): 07
(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++?

Q.3 (a) Discuss benefits of multithreading? 03


(b) Develop a program which stores name of districts in Gujrat in array of String. 04
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.
(c) Characterize the two ways of implementing thread in Java? Illustrate each 07
method by example?
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 04
each type of exception?
(c) Implement java code to take some (say 10) Strings from users. Put all the 07
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

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 07
to insert and delete elements at the beginning of a list? What methods are in
LinkedList but not in ArrayList?

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 07
program to demonstrate any one of them?
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 07
amount, annual interest
2
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?

***********

3
Enrolment No./Seat No_______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–IV (NEW) EXAMINATION – SUMMER 2024
Subject Code:3140705 Date:08-07-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) Answer in one word:(one mark for each) 03
I. Which integral type in Java has the exact range from -
2147483648 (-231) to 2147483647 (231-1).
II. The software for developing and running Java
programs.
III. It is similar to machine instructions but is
architecture neutral and can run on any platform that has
a Java Virtual Machine (JVM).
(b) Write a program that reads an integer and adds all the 04
digits in the integer. For example, if an integer is 932, the
sum of all its digits is 14.
Hint: Use the % operator to extract digits, and use the /
operator to remove the extracted digit. For instance, 932
% 10 = 2 and 932 / 10 = 93.

(c) Analyze following code pieces (assume they are properly 07


enclosed in class and main function) and write the
output/error (No justification is required): (one mark for
each)
I. int num = 5;
int x = 1;
for (int i = 1; i <= num; i++) {
x *= i;
}
System.out.println("x is " + x);

II. int[] nums = {1, 5, 3, 9, 7};

int m= 1;
int s= 0;
for (int i = 0; i < nums.length; i++) {
if (nums[i] > m) {
s = m;
m = nums[i];
} else if (nums[i] > s && nums[i] != m) {
s = nums[i];
}
}
System.out.println("s is: " + s);

P
A
G
III. int i=1,j=0,k=0;
if (i > k) {
if (j > k)
System.out.println("i and j are greater than k");
}
else
System.out.println("i is less than or equal to k");
IV. int x = 3, y = 3;
switch (x + 3) {
case 6: y = 1;
default: y += 1;
}
System.out.println("y is " + y);
V. class HelloWorld {
public static void main(String[] args) {
int[] numbers = new int[1];
numbers[0]=0;
m(numbers);
System.out.println("numbers[0] is" +
numbers[0]);
}
public static void m(int[] y) {
y[0] = 3;
}
}
VI. StringBuffer s1 = new StringBuffer("Complete");
s1.setCharAt(1,'i');
s1.setCharAt(7,'d');
System.out.println(s1);
VII. int Integer = 24;
char String ='I';
System.out.print(Integer);
System.out.print(String);

Q.2 (a) Describe the relationship between an object and its 03


defining class.
(b) Write java statements for following class: 04
public class Counter {
int c;
}
i. Declare a parameterized constructor to initialize
variable c.
ii. Declare instance method to increment c and return
updated value of c.

(c) Justify following: 07


i. In general, constructors should be public.
ii. Why main is declared as static.
iii. Why we do not declare destructors in java.
iv. There is no pointer in java.
OR
(c) Differentiate between following: 07
i. this keyword vs super keyword
ii. abstract class vs interface
Q.3 (a) Give definition of method overloading. 03

P
A
G
(b) i. Analyze following code pieces and write the 04
output/error and briefly justify output:
public class Test {
public static void main(String[] args) {
new Person().printPerson();
new Student().printPerson();
}
}

class Student extends Person {


@Override
public String getInfo() {
return "Student";
}
}

class Person {
public String getInfo() {
return "Person";
}

public void printPerson() {


System.out.println(getInfo());
}
}
ii. Given the following source code, which comment line
can be uncommented without introducing errors?
abstract class MyClass {
abstract void f();
final void g() {}
//final void h() {} // comment (1)
}
final class MyOtherClass extends MyClass {
public static void main(String[] args) {
MyClass mc = new MyOtherClass();
}
void f() {}
void h() {}
//void g() {} // comment (2)
}

(c) Discuss public, private, protected and default access 07


modifiers with examples.
OR
Q.3 (a) What is the final keyword? Give different uses of the final 03
keyword.
(b) Declare an interface called Function that has a method 04
named evaluate that takes an int parameter and returns an
int value.
Create a class called Half that implements the Function
interface. The implementation of the method evaluate()
should return the value obtained by dividing
the int argument by 2.
(c) What is an Exception? Explain Exception handling in 07
JAVA with the help of example.

P
A
G
Q.4 (a) How do keyword throw differ from throws in Exception 03
handling?
(b) Differentiate between a byte oriented and a character- 04
oriented stream.
(c) Explain binary I/O classes. Demonstrate java file I/O with 07
any I/O class to read a text file.
OR
Q.4 (a) Compare JavaFX with Swing and AWT. 03
(b) i. List any four UI controls in JavaFX. 04
ii. List any two Panes for Containing and Organizing
Nodes
(c) Write a program to demonstrate GUI application 07
development using JavaFX.
Q.5 (a) What are the differences between ArrayList and 03
LinkedList? Which list should you use to insert and delete
elements at the beginning of a list?
(b) What is Java Collection Framework? List four collection 04
classes?
(c) Give the name of class or interface that provides following 07
facility (Do not elaborate)(one mark for each)
i. Dynamic array to store the duplicate element of different
data types. It maintains the insertion order.
ii. Implements the last-in-first-out data structure.
iii. Implements the first-in-first-out data structure.
iv. Implements the first-in-first-out data structure and it
holds the elements or objects which are to be processed by
their priorities.
v. It represents the unordered set of elements which
doesn't allow us to store the duplicate items.
vi. It is a red-black tree-based implementation. It provides
an efficient means of storing key-value pairs in sorted
order.
vii. It allows us to store key and value pair, where keys
should be unique.
OR
Q.5 (a) Explain thread life cycle. 03
(b) What is the package? Explain steps to create a package 04
with example.
(c) Declare a class called Employee having employee_Id and 07
employee_Name as members.
Extend class Employee to have a subclass called
SalariedEmployee having designation and
monthly_salary as members. Define following:
- Required constructors
- Methods to insert, update and display all details of
employees.
- Method main for creating an array for storing these
details given as command line arguments and showing
usage of above methods.

***********

P
A
G
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705
Semester – IV
Subject Name: Object Oriented Programming -I
Type of course: core course

Prerequisite: None

Rationale: Object oriented Programming has become a fundamental part of software development. OOP
facilitates Reuse of code, flexibility, effective problem solving. It provides a modular structure for programs
and implementation details are hidden. Reuse of code lowers the cost of development.

Teaching and Examination Scheme:

Teaching Scheme Credits Examination Marks Total


L T P C Theory Marks Practical Marks Marks
ESE (E) PA (M) ESE (V) PA (I)
4 0 2 5 70 30 30 20 150

Content:

Sr. No. Content Total


Hrs

1 Introduction to java and elementary programming: 4


Java language specification API, JDK and IDE, Creating, compiling and Executing a
simple java program, Programming style, documentation and errors, Reading input from
console, identifiers and variables, Assignment statements, Named constants and naming
conventions, Data Types (Numeric, Boolean, Character, String) its Operations and
Literals, Evaluating Expressions and operator Precedence, Types of Operators (Augmented
assignment, Increment and Decrement, Logical), operator precedence and associativity,
numeric type conversions.
2 Selections , Mathematical functions and loops: 4
If statements, Two way, Nested if and multi-way if statements, Switch statements,
Conditional Expressions, Common mathematical functions ,While , do-while and for loop,
nested loops, Keyword break and continue.
3 Methods and Arrays: 6
Defining and calling method, Passing argument by values, Overloading methods and scope
of variables, Method abstraction and stepwise refinement, Single Dimensional arrays,
copying arrays ,Passing and returning array from method, Searching and sorting arrays
and the Array class, Two-Dimensional array and its processing, Passing Two-dimensional
Array to methods, Multidimensional Arrays.
4 Objects and Classes: 4
Defining classes for objects, Constructors, accessing objects via reference variable, using
classes from the java library, static variables, constants and methods, visibility modifiers
and Data field encapsulation, passing objects to methods, array of objects, immutable
Page 1 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705
objects and classes, scope of variable and the this reference.

5 Object oriented thinking: 5


Class abstraction and Encapsulation, thinking in objects and class relationships, Primitive
data type and wrapper class types, Big integer and Big decimal class, string class, String
Builder and String Buffer class, super class and subclass, using super keyword, overriding
and overloading methods, polymorphism and dynamic binding, casting objects and
instanceof operator, The ArrayList class and its methods, The protected data and methods.
6 Exception Handling, I/O, abstract classes and interfaces: 4
Exception types, finally clause, rethrowing Exceptions, chained exceptions, defining
custom exception classes, file class and its input and output, Reading data from web,
Abstract classes, interfaces, Comparable and Cloneabal interface.
7 JAVAFX basics and Event-driven programming and animations: 5
Basic structure of JAVAFX program, Panes, UI control and shapes, Property binding, the
Color and the Font class, the Image and Image-View class, layout panes and shapes,
Events and Events sources, Registering Handlers and Handling Events, Inner classes,
anonymous inner class handlers, mouse and key events, listeners for observable objects,
animation
8 JAVAFX UI controls and multimedia: 4
Labeled and Label, button, Checkbox, RadioButton, Textfield, TextArea, Combo Box,
ListView, Scrollbar, Slider, Video and Audio.
9 Binary I/O ,Recursion and Generics: 4
Text I/O, binary I/O, Binary I/O classes, Object I/o, Random Access files, Problem solving
using Recursion, Recursive Helper methods, Tail Recursion, Defining Generic classes and
interfaces, Generic methods, Raw types and backward compatibility, wildcard Generic
types, Erasure and Restrictions on Generics.
10 List, Stacks, Queues and Priority Queues: 4
Collection, Iterators, Lists, The Comparator interface, static methods for list and
collections, Vector and Stack classes, Queues and priority Queues.
11 Sets and Maps: 2
Comparing the performance of Sets and Lists, singleton and unmodifiable collections and
Maps.
12 Concurrency 2
Thread states and life cycle,Creating and Executing threads with the Executor
Framework, Thread synchronization

Suggested Specification table with Marks (Theory): (For BE only)

Distribution of Theory Marks

R Level U Level A Level N Level E Level C Level


10 50 10 - - -

Legends: R: Remembrance; U: Understanding; A: Application, N: Analyze and E: Evaluate C:


Create and above Levels (Revised Bloom’s Taxonomy)

Page 2 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705

Note: This specification table shall be treated as a general guideline for students and teachers. The actual
distribution of marks in the question paper may vary slightly from above table.

Reference Books:

1) Intro to Java Programming, 10th edition, Y.Daniel Liang, Pearson

2) Object oriented programming with Java , Rajkumar Buyya,S Thamarai Selvi, Xingchen Chu,
McGrawHill

3) Programming in Java, Sachin Malhotra, Saurabh Choudhary, Oxford

4) Programming with JAVA , E Balagurusamy, McGrawHill

5) CORE JAVA volume -I Cay Horstmann, Pearson

Course Outcomes:

Sr. CO statement Marks % weightage


No.

CO-1 Use various Java constructs, features and libraries for simple problems. 20

CO-2 Demonstrate how to define and use classes, interfaces, create objects and 20
methods, how to override and overload methods, compile and execute
programs.

CO-3 Write a program using exception handling, multithreading with 20


synchronization.

CO-4 Write a program using Files, binary I/O, collection Frameworks for a 30
given problem.

CO-5 Design and develop GUI based applications in a group using modern 10
tools and frameworks.

List of Experiments:

(1) Write a Program that displays Welcome to Java, Learning Java Now and Programming is fun.

Page 3 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705
Write a program that solves the following equation and displays the value x and y:
(2) 1) 3.4x+50.2y=44.5 2) 2.1x+.55y=5.9 (Assume Cramer’s rule to solve equation
ax+by=e x=ed-bf/ad-bc
cx+dy=f y=af-ec/ad-bc )
(3) Write a program that reads a number in meters, converts it to feet, and displays the result.

Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your
(4) weight in kilograms and dividing by the square of your height in meters. Write a program that
prompts the user to enter a weight in pounds and height in inches and displays the BMI.
Note:- 1 pound=.45359237 Kg and 1 inch=.0254 meters.
(5) Write a program that prompts the user to enter three integers and display the integers in decreasing
order.
(6) Write a program that prompts the user to enter a letter and check whether a letter is a vowel or
constant.
(7) Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write a
program to generate a plate number.
(8) Write a program that reads an integer and displays all its smallest factors in increasing order. For
example if input number is 120, the output should be as follows:2,2,2,3,5.
Write a method with following method header.
(9)
public static int gcd(int num1, int num2)
Write a program that prompts the user to enter two integers and compute the gcd of two integers.
(10) Write a test program that prompts the user to enter ten numbers, invoke a method to reverse the
numbers, display the numbers.
(11) Write a program that generate 6*6 two-dimensional matrix, filled with 0’s and 1’s , display the
matrix, check every raw and column have an odd number’s of 1’s.
(12) Write a program that creates a Random object with seed 1000 and displays the first 100 random
integers between 1 and 49 using the NextInt (49) method.
Write a program for calculator to accept an expression as a string in which the operands and
(13)
operator are separated by zero or more spaces.
For ex: 3+4 and 3 + 4 are acceptable expressions.
Write a program that creates an Array List and adds a Loan object , a Date object , a string, and a
(14)
Circle object to the list, and use a loop to display all elements in the list by invoking the object’s to
String() method.
Write the bin2Dec (string binary String) method to convert a binary string into a decimal number.
(15)
Implement the bin2Dec method to throw a NumberFormatException if the string is not a binary
string.
Write a program that prompts the user to enter a decimal number and displays the number in a
(16) fraction.
Hint: Read the decimal number as a string, extract the integer part and fractional part from the
string.
(17) Write a program that displays a tic-tac-toe board. A cell may be X, O, or empty. What to display at
each cell is randomly decided. The X and O are images in the files X.gif and O.gif.
(18) Write a program that moves a circle up, down, left or right using arrow keys.

(19) Write a program that displays the color of a circle as red when the mouse button is pressed and as
blue when the mouse button is released.
Page 4 of 5

w.e.f. AY 2018-19
GUJARAT TECHNOLOGICAL UNIVERSITY
Bachelor of Engineering
Subject Code: 3140705
(20) Write a GUI program that use button to move the message to the left and right and use the radio
button to change the color for the message displayed.
Write a program to create a file name 123.txt, if it does not exist. Append a new data to it if it
(21)
already exist. write 150 integers created randomly into the file using Text I/O. Integers are
separated by space.
(22) Write a recursive method that returns the smallest integer in an array. Write a test program that
prompts the user to enter an integer and display its product.
(23) Write a generic method that returns the minimum elements in a two dimensional array.

(24) Define MYPriorityQueue class that extends Priority Queue to implement the Cloneable interface
and implement the clone() method to clone a priority queue.
(25) Write a program that reads words from a text file and displays all the nonduplicate words in
descending order.The text file is passed as a command-line argument.

Major Equipment:

Computer, Laptop

List of Open Source Software/learning website:

https://www.tutorialspoint.com/java/

https://www.javatpoint.com/java-programs

Page 5 of 5

w.e.f. AY 2018-19

You might also like