3rd Sem Oops 2018 Questions Bput
3rd Sem Oops 2018 Questions Bput
1. Home
2. /
3. Object Oriented Programming Using Java
4. /
5. Previous Year Questions
Questions
See the original Question
1 a.
What is garbage collection? What is the process that is responsible for doing that in java? ( 2 Marks )
Ans:
1 b.
Name the access modifiers in java. ( 2 Marks )
Ans:
1 c.
How do you comparing two strings by ignoring the case? Give an example. ( 2 Marks )
Ans:
Declaration
Following is the declaration
for java.lang.String.equalsIgnoreCase() method
public boolean equalsIgnoreCase(String anotherString)
Parameters
anotherString − This is the String to compare this String against.
Return Value
This method returns true if the argument is not null and it
represents an equivalent String ignoring case, else false.
Exception
NA
Example
The following example shows the usage of
java.lang.String.equalsIgnoreCase() method.
package com.tutorialspoint;
import java.lang.*;
1 d.
What are the restrictions that are applied to the Java static methods? ( 2 Marks )
Ans:
There are two main restrictions for the static method. They are:
The static method can not use non static data member or call
non-static method directly. this and super cannot
be used in static context.
1 e.
What is difference between StringBuffer and StringBuilder? ( 2 Marks )
What is difference between StringBuffer and StringBuilder?
1 f.
Differentiate between checked and unchecked exception. ( 2 Marks )
1 g.
How java supports inter-thread communication? ( 2 Marks )
1 h.
What is the difference between object oriented programming language and object based programming
language? ( 2 Marks )
1 i.
What is constructor chaining and how is it achieved in Java? ( 2 Marks )
1 j.
What will happen if static modifier is removed from the signature of the main method? ( 2 Marks )
Focused Short Answer Type Questions (Answer Any Eight out of Twelve)
2 a.
Briefly explain various features of java. ( 6 Marks )
2 b.
Write an application that executes two threads. one thread displays "GOOD MORNING" in every 1000
milliseconds ( 6 Marks )
Write an application that executes two threads. one thread
displays "GOOD MORNING" in every 1000 milliseconds and another
thread displays "GOOD AFTERNOON" in every 3000 milliseconds.
Create the thread by implementing the Runnable interface.
2 c.
Write a java program to print prime number up to 100. ( 6 Marks )
2 d.
Explain method overloading and method overriding with the help of example. ( 6 Marks )
2 e.
Compare string with string buffer. Write a java program to count occurrence of character in a string. ( 6
Marks )
2 f.
Write a java program to convert the given temperature in Fahrenheit to Celsius using the following
conversion formula ( 6 Marks )
Write a java program to convert the given temperature in
Fahrenheit to Celsius using the following conversion formula C = (F -
32)/1.8 and display the values in a tabular form.
2 g.
How exceptions are handled in java? Explain the important methods used to handle exceptions. ( 6 Marks
)
2 h.
Write a java program which draws a dashed line and dotted line using applet. ( 6 Marks )
2 j.
Write a program that will read an unspecified number of integers and will de-termine,? ( 6 Marks )
Write a program that will read an unspecified number of integers
and will de-termine? how many positive and negative values have
been read. Your programends when the input is 0.
2 k.
Discuss the various types of operators in java and explain with suitable example. ( 6 Marks )
2 l.
What is layout manager? Explain different types of layout managers. ( 6 Marks )
3 a.
Write a Java program to create user defined exception. ( 8 Marks )
3 b.
Explain the types of inheritances in java with example, ( 8 Marks )
4 a.
What is interface? How do you achieve multiple inheritance through interface?Explain with an example.
( 8 Marks )
Ans:Upgrade toto see this answer
4 b.
Write a program to replace all ''word 1'' by ''word 2'' to a file without using temporary file and display
the number of replacements. ( 8 Marks )
5 a.
Briefly explain the various components of swing. ( 8 Marks )
5 b.
What is multithreading? briefly explain the different states of a thread. ( 8 Marks )
6 a.
Explain the different features of object oriented programming. ( 8 Marks )
6 b.
What is an applet? Explain the life-cycle of an applet. ( 8 Marks )