Friday 7 April 2017

Java Sample Paper




NIELIT A Level Java Soled Paper
January, 2015
A10.1-R4: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA


PART ONE
(Answer all the questions)

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 one of the following is not an AWT Event class?
A) MenuEvent
B) MouseEvent
C) ActionEvent
D) InputEvent

1.2 Which method of an Object class is used to determine the class of an object?
A) getName()
B) getClass(
C) clone()
D) toString()
1.3 Which of the following operators is used in conjunction with this and super references?
A) the new operator
B) the instanceOf operator
C) the (.) dot operator
D) All of the above
1.4 What is the return type of the values() method of the Map interface?
A) Set
B) Collection
C) Enumeration
D) Map.Entry
1.5 What is the output of the following code?
int x = 12;
while (x<10) { x--; }
System.out.println(x);
A) 0
B) 12
C) 10
D) Compilation error

1.6 Which TextComponent method is used to set a TextComponent to the read-only state?
A) isEditable()
B) setReadOnly()
C) setEditable()
D) setFocusable()
1.7 Which one of the following is implicitly extended by all enum types?
A) Enum
B) Enumeration
C) EnumMap
D) EnumSet
1.8 Which one of the following wrapper classes does not have “String” type in its constructor?
A) Long
B) Boolean
C) Integer
D) Character
1.9 What is the output of the following program?
public class TestingString
{
   public static void main(String args[])
   {
        String testing = "this is testing";
        String tokens[] = testing.split("\s");
        System.out.println(tokens.length);                      
   }
}
A) 0
B) 1
C) Compilation Error
D) An exception is thrown at runtime
1.10 Swing components that rely on native GUI are referred to as
A) heavyweight components
B) lightweight components
C) GUI components
D) non-GUI components

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 Character literals are stored as unicode characters.
2.2 An ArrayList object stores object of the same type only.
2.3 Boolean values can be cast into any other primitive type.
2.4 The garbage collector will run immediately when the system is out of memory.
2.5 Reusability is an important aspect of designing classes.
2.6 StringBuffer objects are immutable.
2.7 setVisible method will cause a frame to be displayed.
2.8 A parameterized class is actually not a class, it is template.
2.9 setExtendedState() method is used to set the close operation for JFrame based frame.
2.10 Assertions are a commonly used idiom for defensive programming.

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
Generalization
A.
java.io.File
3.2
Object
B.
“has-a” relationship
3.3
a top level window with a titlebar and a menubar
C.
setText() method
3.4
deleteIfExists() method
D.
configuration of instance
3.5
Aggregation.
E.
“is a” relationship
3.6
Label class
F.
Frame
3.7
String class
G.
java.io package
3.8
An immediate subclass of a Container class
H.
java.nio.file.Files
3.9
deleteOnExit() method
I.
format() method
3.10
Random class
J.
Window


K.
java.util package


L.
“is - a” relationship


M.
Access Control

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.
AppletStub
B.
System.err
C.
StreamCorruptedException
D.
Namespace
E.
MouseMotionListener
F.
Component
G.
Graphics
H.
ObjectInputStream
I.
RuntimeException
J.
Use Case
K.
AppletContext
L.
MouseListener
M.
Class





4.1 The ________ interface provides the means by which an applet and the browser communicate.
4.2 ________ is a predefined stream variable of public, final and static type.
4.3 In Object Oriented Programming, each package represents a ________.
4.4 ________ is thrown when control information that was read from an object stream violates
internal consistency checks.
4.5 BufferOverflowException extends ________ class.
4.6 The paint() method defined in a Container class has a parameter of type ________.
4.7 ________ diagram shows a set of use cases and actors and their relationships.
4.8 The ________ class supports the reading of objects from input streams.
4.9 In order to capture the events when mouse is dragged, ________ interface is used.
4.10 The setBackground( ) method is defined in the class ________.

PART TWO
(Answer any FOUR questions)

5.
a) Explain the concept of data encapsulation, inheritance and polymorphism in Object Oriented
Programming Language.
b) Briefly discuss importance of following diagrams in UML:
i) Sequence Diagrams
ii) Activity Diagrams
(7+8)
6.
a) What is an Applet? Explain the life cycle of the Applet.
b) Explain any two layout managers available in AWT in brief.
c) Explain creation of MenuBars, Menus and MenuItems with examples.
(5+5+5)
7.
a) Differentiate between abstract class and interface.
b) What is an exception? Explain exception handling mechanism with example.
c) Explain the jdk command line development tools javac, java, javap, appletviewer and javadoc
available in Java.
(5+5+5)
8.
a) Explain static and non-static nested classes with appropriate example.
b) Write the functionality provided by java.util.zip package and list any four classes under it.
c) Explain the consistency rules to be observed whenever we override equals() method.
(5+5+5)
9.
a) What are the access specifiers available in Java? Explain each of them. State which of these
can be applied to members of a class, and which an be applied to members of a package.
b) Explain steps to call a stored procedure created in a database through CallableStatement.
(7+8)

Download PDF

No comments:

Post a Comment