MCA 3rd semester 2013 object technology solved paper MDU

Que. :- What is iterative statement in java ?

Iteration statements cause statements (or compound statements) to be executed zero or more times, subject to some loop-termination criteria. When these statements are compound statements, they are executed in order, except when either the break statement or the continue statement is encountered.
Loops are basically means to do a task multiple times, without actually coding all statements over and over again.
For example, loops can be used for displaying a string many times, for counting numbers and of course for displaying menus.

Loops in Java are mainly of three types :-

1. ‘while’ loop
2. ‘do while’ loop
3. ‘for’ loop

Que 2:- What is scope variable in java?
Scope of a variable is the part of the program where the variable is accessible. Like C/C++, in Java, all identifiers are lexically (or statically) scoped, i.e.scope of a variable can determined at compiler time and independent of function call stack.
Java programs are organized in the form of classes. Every class is part of some package. Java scope rules can be covered under following categories.
Que :- What is String buffer class ?
Java StringBuffer class is used to create mutable (modifiable) string. The StringBuffer class in java is same as String class except it is mutable i.e. it can be changed.
StringBuffer – creates an empty string buffer with the initial capacity of 16

Que :- final keyword in java ?

The final keyword in java is used to restrict the user. The java final keyword can be used in many context. Final can be:

  1. variable
  2. method
  3. class

The final keyword can be applied with the variables, a final variable that have no value it is called blank final variable or uninitialized final variable. It can be initialized in the constructor only. The blank final variable can be static also which will be initialized in the static block only. We will have detailed learning of these. Let’s first learn the basics of final keyword.


If you make any variable as final, you cannot change the value of final variable(It will be constant).

Declaration – final int a=20; // it is declaration of final keyword in java

Que:- What is main Thread?

When we start any java program, one thread begins running immediately, Which is called main thread of java program.

The main thread created automatically when your java program started.


Class onlinestudy{

public static void main(String []args){

System.out.println(“Main therad”);




Que :- What is classpath?

Classpath is a parameter in the Java Virtual Machine or the Java compiler that specifies the location of user-defined classes and packages. The parameter may be set either on the command-line, or through an environment variable.

Que :- What is paint mode?



Que:-What is status Window?



Que :- What is the history and features of java ?Explain various expression and operator available     in  java ?

The history of Java is very interesting. Java was originally designed for interactive television, but it was too advanced technology for the digital cable television industry at the time. The history of java starts with Green Team. Java team members (also known as Green Team), initiated this project to develop a language for digital devices such as set-top boxes, televisions, etc. However, it was suited for internet programming. Later, Java technology was incorporated by Netscape.

The principles for creating Java programming were “Simple, Robust, Portable, Platform-independent, Secured, High Performance, Multithreaded, Architecture Neutral, Object-Oriented, Interpreted and Dynamic”.

James Gosling - founder of java

Currently, Java is used in internet programming, mobile devices, games, e-business solutions, etc. There are given the significant points that describe the history of Java.

1) James GoslingMike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team.

2) Originally designed for small, embedded systems in electronic appliances like set-top boxes.

3) Firstly, it was called “Greentalk” by James Gosling, and file extension was .gt.

4) After that, it was called Oak and was developed as a part of the Green project.

Why Java named “Oak”?

5) Why Oak? Oak is a symbol of strength and chosen as a national tree of many countries like U.S.A., France, Germany, Romania, etc.

6) In 1995, Oak was renamed as “Java” because it was already a trademark by Oak Technologies.

Features of Java

The primary objective of Java programming language creation was to make it portable, simple and secure programming language. Apart from this, there are also some excellent features which play an important role in the popularity of this language. The features of Java are also known as java buzzwords.

A list of most important features of Java language is given below.


  1. Simple
  2. Object-Oriented
  3. Portable
  4. Platform independent
  5. Secured
  6. Robust
  7. Architecture neutral
  8. Interpreted
  9. High Performance
  10. Multithreaded
  11. Distributed
  12. Dynamic


Expressions are essential building blocks of any Java program, usually created to produce a new value, although sometimes an expression simply assigns a value to a variable. Expressions are built using values, variables, operators and method calls.

Types of Expressions

While an expression frequently produces a result, it doesn’t always. There are three types of expressions in Java:

  • Those that produce a value, i.e. the result of (1 + 1)
  • Those that assign a variable, for example (v = 10)
  • Those that have no result but might have a “side effect” because an expression can include a wide range of elements such as method invocations or increment operators that modify the state (i.e. memory) of a program.

Operators in java

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups −

  • Arithmetic Operators
  • Relational Operators
  • Bitwise Operators
  • Logical Operators
  • Assignment Operators
  • Misc Operators

Que:- Declaration and usage of array using example?

Normally, an array is a collection of similar type of elements that have a contiguous memory location.

Java array is an object which contains elements of a similar data type. It is a data structure where we store similar elements. We can store only a fixed set of elements in a Java array.

Array in java is index-based, the first element of the array is stored at the 0 index.



public class Example {

public static void main(String[] args) {
int a[]=new int [5];
for(int i=0;i<a.length;i++)




Que:- Automatic garbage collection and control statement in java?

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.

To do so, we were using free() function in C language and delete() in C++. But, in java it is performed automatically. So, java provides better memory management

Advantage of Garbage Collection

  • It makes java memory efficient because garbage collector removes the unreferenced objects from heap memory.
  • It is automatically done by the garbage collector(a part of JVM) so we don’t need to make extra efforts.

finalize() method

The finalize() method is invoked each time before the object is garbage collected. This method can be used to perform cleanup processing. This method is defined in Object class as:


public class TestGarbage1{
public void finalize(){System.out.println(“object is garbage collected”);}
public static void main(String args[]){
TestGarbage1 s1=new TestGarbage1();
TestGarbage1 s2=new TestGarbage1();



Remaining part soon




Author: Team

Leave a Reply

Your email address will not be published. Required fields are marked *