Thursday, 6 April 2017

Java Solved Paper

NIELIT Java Sample Paper Solved

July, 2013

A10.1-R4: INTRODUCTION TO OBJECT ORIENTED PROGRAMMING THROUGH JAVA

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)
1.1 Which is a valid key word in Java?
A) Integer
B) unsigned
C) string
D) class
1.2 public interface
{
int i=10;//line1
}
Which piece of codes is equivalent to line 1?
A) public int i = 10;
B) static int i = 10
C) public static int i = 10;
D) public static final int i = 10
1.3 Which one is a valid declaration of a Boolean?
A) boolean b1 = 0;
B) boolean b2 = 'false';
C) boolean b3 = false;
D) None of the above
1.4 What will be the output of the following code segments?
int x = 0xf1;
x = byte(x >>3);
System.out.println(x);
A) -1
B) -2
C) 1
D) 2

1.5 Exception and Error are immediate subclasses of a class called
A) Object
B) Throwable
C) AWT
D) Panel
1.6 Dynamic method dispatch is an example of
A) template
B) Run-time polymorphism
C) Compile-time polymorphism
D) specialization
1.7 In a package if a class is declared without any keyword then
A) It can-not be inherited.
B) It can be accessed in another package.
C) It can-not be accessed in another package.
D) It is private by default
1.8 Protected member of a class in JAVA
A) Can be inherited by derived class but cannot be accessed directly through an object
B) Cannot be inherited by derived class and can be accessed directly through an object
C) Can be inherited by derived class and can be accessed directly through an object
D) Cannot be inherited by derived class and cannot be accessed directly through an object
1.9 If a method is declared as final in a class then
A) It can-not be accesses outside the class
B) It can be redefined in a subclass
C) It can-not be inherited in a subclass
D) None of the above
1.10 Class diagram at conceptual level should include
A) attributes only
B) operations only
C) Both attributes and operations
D) None of the above

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

2.1 Swing relies on operating system for its functionality.
2.2 Constructor has no return type.
2.3 In object oriented programming data can not be directly accessed out-side the class without
object.
2.4 Applets do not need a main method.
2.5 The name of a java program file must match the name of the class.
2.6 Declaration can appear anywhere in the body of java method.
2.7 Java technology is both a programming language and a platform.
2.8 Java programming is not statically-typed, means all variables should not first be declared
before they can be used.
2.9 In a method or a constructor, "this" is a reference to the current object.
2.10 Default case is always required in switch.

3. Match words and phrases in column X with the closest related meaning/word(s)/phrase(s) in column Y. Enter your selection in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

X

Y

3.1

Compares characters inside String Object

A.

Panel

3.2

System. in is an object of type

B.

PrintStream

3.3

A class declared as final
cannot be

C.

Instantiated

3.4

Super class of all events

D.

InputStream

3.5

The immediate super class of applet class is

E.

Runtime

3.6

Method overloading is an
example of polymorphism caused at

F.

equals ()

3.7

Code reusability is achieved through

G.

Inherited

3.8

Exception is an error caused at

H.

== operator

3.9

Abstract classes cannot be

I.

Method overriding

3.10

Base class constructor can
be invoked using

J.

EventObject

K.

Compile time

L.

Inheritance

M.

super

4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

A.

paint()

B.

isAlive() and join()

C.

finally

D.

static

E.

Error

F.

Wait() and notify()

G.

Component

H.

java.lang

I.

Container

J.

Panel

K.

public

L.

private

M.

toString()

4.1 ________ data member is shared among all instances of that class.
4.2 Immediate super class of Panel class is ________.
4.3 Constructors are defined in ________ section of a class.
4.4 Functions used for string representation of object is ________.
4.5 ________ are used to achieve inter-thread communication.
4.6 Java automatically import ________ package.
4.7 ________ contains the exceptions which are not supposed to handle by user program.
4.8 try block without catch must have ________ block.
4.9 Container is a subclass of ________ class.
4.10 When an applet output must be redrawn a ________ method is invoked.