0% found this document useful (0 votes)
274 views

3rd Sem Oops 2018 Questions Bput

This document contains exam questions and solutions related to Object Oriented Programming Using Java. It includes short answer questions covering topics such as garbage collection, access modifiers, comparing strings ignoring case, restrictions on static methods, differences between StringBuffer and StringBuilder, checked and unchecked exceptions, inter-thread communication, constructor chaining, and removing the static modifier from the main method. It also includes focused short answer questions and long answer questions on various OOP and Java topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
274 views

3rd Sem Oops 2018 Questions Bput

This document contains exam questions and solutions related to Object Oriented Programming Using Java. It includes short answer questions covering topics such as garbage collection, access modifiers, comparing strings ignoring case, restrictions on static methods, differences between StringBuffer and StringBuilder, checked and unchecked exceptions, inter-thread communication, constructor chaining, and removing the static modifier from the main method. It also includes focused short answer questions and long answer questions on various OOP and Java topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Exam Questions Solutions for Biju Patnaik

University of Technology Rourkela Odisha


B.Tech Computer Science Engineering
OBJECT ORIENTED PROGRAMMING
USING JAVA 3rd Semester 2018
Find Notes on OBJECT ORIENTED PROGRAMMING USING JAVA
Click here to access your understanding on OBJECT ORIENTED PROGRAMMING USING JAVA

1. Home
2. /
3. Object Oriented Programming Using Java
4. /
5. Previous Year Questions
Questions
See the original Question

 Short Answer Type Questions (Answer All -10)

1 a.
What is garbage collection? What is the process that is responsible for doing that in java? ( 2 Marks )

Ans:

In java, garbage means unreferenced objects. Garbage


Collection is process of reclaiming the runtime unused memory
automatically. In other words, it is a way to destroy the unused
objects.

 1 b.
Name the access modifiers in java. ( 2 Marks )

Ans:

There are three access specifiers: public, private and protected.

 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.*;

public class StringDemo {

public static void main(String[] args) {

String str1 = "sachin tendulkar";


String str2 = "amrood admin";
String str3 = "AMROOD ADMIN";

// checking for equality with case ignored


boolean retval1 = str2.equalsIgnoreCase(str1);
boolean retval2 = str2.equalsIgnoreCase(str3);

// prints the return value


System.out.println("str2 is equal to str1 = " + retval1);
System.out.println("str2 is equal to str3 = " + retval2);
}
}

 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?

Ans:Upgrade toto see this answer

 1 f.
Differentiate between checked and unchecked exception. ( 2 Marks )

Ans:Upgrade toto see this answer

 1 g.
How java supports inter-thread communication? ( 2 Marks )

Ans:Upgrade toto see this answer

 1 h.
What is the difference between object oriented programming language and object based programming
language? ( 2 Marks )

Ans:Upgrade toto see this answer

 1 i.
What is constructor chaining and how is it achieved in Java? ( 2 Marks )

Ans:Upgrade toto see this answer

 1 j.
What will happen if static modifier is removed from the signature of the main method? ( 2 Marks )

Ans:Upgrade toto see this answer

 Focused Short Answer Type Questions (Answer Any Eight out of Twelve)

2 a.
Briefly explain various features of java. ( 6 Marks )

Ans:Upgrade toto see this answer

 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.

Ans:Upgrade toto see this answer

 2 c.
Write a java program to print prime number up to 100. ( 6 Marks )

Ans:Upgrade toto see this answer

 2 d.
Explain method overloading and method overriding with the help of example. ( 6 Marks )

Ans:Upgrade toto see this answer

 2 e.
Compare string with string buffer. Write a java program to count occurrence of character in a string. ( 6
Marks )

Ans:Upgrade toto see this answer

 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.

Ans:Upgrade toto see this answer

 2 g.
How exceptions are handled in java? Explain the important methods used to handle exceptions. ( 6 Marks
)

Ans:Upgrade toto see this answer

 2 h.
Write a java program which draws a dashed line and dotted line using applet. ( 6 Marks )

Ans:Upgrade toto see this answer


 2 i.
What is package? How do you create a package? Explain about the accessprotection in packages? ( 6
Marks )

Ans:Upgrade toto see this answer

 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.

Ans:Upgrade toto see this answer

 2 k.
Discuss the various types of operators in java and explain with suitable example. ( 6 Marks )

Ans:Upgrade toto see this answer

 2 l.
What is layout manager? Explain different types of layout managers. ( 6 Marks )

Ans:Upgrade toto see this answer

 Long Answer Type Questions(Answer Any Two out of Four)

3 a.
Write a Java program to create user defined exception. ( 8 Marks )

Ans:Upgrade toto see this answer

 3 b.
Explain the types of inheritances in java with example, ( 8 Marks )

Ans:Upgrade toto see this answer

 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 )

Ans:Upgrade toto see this answer

 5 a.
Briefly explain the various components of swing. ( 8 Marks )

Ans:Upgrade toto see this answer

 5 b.
What is multithreading? briefly explain the different states of a thread. ( 8 Marks )

Ans:Upgrade toto see this answer

 6 a.
Explain the different features of object oriented programming. ( 8 Marks )

Ans:Upgrade toto see this answer

 6 b.
What is an applet? Explain the life-cycle of an applet. ( 8 Marks )

Ans:Upgrade toto see this answer

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy