Sunday, 9 April 2017

NIELIT A Level Solve Paper 
Java -July-2016
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 of the following class is a superclass that declares the common features of GUI
components in packages java.awt and javax.swing?
A) Component
B) Container
C) Panel
D) Frame

1.2 The essential characteristics of an object that distinguish it from all other kinds of objects and
thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer is called:
A) Encapsulation
B) Abstraction
C) Modularity
D) Hierarchy
1.3 Why an object is considered an external entity in object-oriented?
A) its attributes change during operation of the system
B) it has numerous attributes
C) it has no attributes relevant to the system
D) its attributes are invariant during operation of the system
1.4 Which of the following provides a convention for unique class names that helps to prevent
class-name conflicts?
A) interface
B) abstract class
C) package
D) super class
1.5 Which command from the JDK should be used to execute the main() method of a class named
SmallProg?
A) java SmallProg
B) javac SmallProg
C) java SmallProg.java
D) java SmallProg.class
1.6 Which of the following variable represents class wide information in which all objects of
the class share the same piece of data?
A) static
B) instance
C) local variable
D) none of the above
1.7 The ________ method of an object is called implicitly, when the object is used of type
String.
A) getHashCode()
B) toObject()
C) toString()
D) toReference()
1.8 Which of the following for loop declaration is invalid?
A) for ( int i = 7; i <= 77; i += 7 )
B) for ( int i = 99; i >= 0; i / 11 )
C) for ( int i = 20; i >= 2; - -i )
D) for ( int i = 2; i <= 20; i = 3 * i )
1.9 Which of the following package contains the classes and interfaces required to create and
manipulate GUIs?
A) Java Applet Package
B) Java Abstract Window Toolkit Event Package
C) Java Abstract Window Toolkit Package
D) Java 2D Shapes Package
1.10 What will be the result of compiling and running the following program?
class Operator
 {
    public static void main(String[] args)
   {
        int count = 1;
        while (count <= 10)
       {
            System.out.println(count % 2 == 1 ?"****" : "++++++++");
             ++count;
       } // end while
      } // end main
} // end class
A) 5 times **** and 5 times ++++++++
B) 10 times ++++++++
C) 10 times ****
D) Will not print anything.

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)
2.1 To test for a range of values in a switch statement, use a hyphen (–) between the start and end values of the range in a case label.
2.2 Arrays are objects, so they’re considered reference types.
2.3 Method overriding is commonly used to create several methods with the same name that perform the same or similar tasks, but on different types or different numbers of arguments.
2.4 Once you declare any constructor in a class, existence of a default constructor remains in
class.
2.5 The compiler produces a separate file with the .class extension for every compiled class.
2.6 The compiler uses a special object called a class finder to locate the classes it needs.
2.7 Converting a primitive-type value to another primitive type retains the value if the new type
is not a valid promotion.
2.8 Methods can return at most one value, but the returned value could be a reference to an
object that contains many values.
2.9 Class Math is part of the java.lang package, which is implicitly imported by the compiler, so
it’s not necessary to import class Math to use its methods.
2.10 The continue statement, when executed in a while, for, do…while or switch, causes
immediate exit from that statement.

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
A reserved word cannot be used as
A.
Object- Oriented Design.
3.2
The formal parameter list is a comma-separated list of parameters for passing information to the method when the method is invoked by
B.
try block
3.3
Non-static nested classes are called inner classes and are frequently  used to implement
C.
Static block
3.4
The method of design encompassing the process of object oriented decomposition and a notation for depicting both logical and physical and as well as static and dynamic models of the system under design is  known as
D.
a method call
3.5
Static variables have
E.
a block.
3.6
You can have many catch blocks to handle different types of exceptions that might be thrown in the corresponding
F.
an identifier.
3.7
Placing a semicolon after the right parenthesis enclosing the parameter  list of a method declaration is
G.
event handlers.
3.8
Sometimes a method performs a task that does not depend on the contents of any object is called
H.
class scope.
3.9
A set of statements contained within a pair of parentheses is called
I.
a syntax error.
3.10
When each object of a class maintains its own copy of an attribute, the field that represents the attribute is also known as
J.
static method.


K.
Overloaded method


L.
Exception


M.
an instance variable

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

A.
JOptionPane
B.
Object
C.
Reference-type
D.
Aggregation
E.
This
F.
increment operator
G.
Overloaded
H.
Command-line arguments
I.
CASE tool
J.
Final
K.
Modularize
L.
heap
M.
Int





4.1 Java’s ________ class (package javax.swing) provides prebuilt dialog boxes for both input and output.
4.2 Single inheritance, multiple inheritance, and ________ comes under Hierarchy.
4.3 ________ constructors enable objects of a class to be initialized in different ways.
4.4 If an instance variable should not be modified, declare it to be ________ to prevent modification.
4.5 Every class in Java has the methods of class ________ (package java.lang), one of which is the finalize
method.
4.6 When a non-static method is called for a particular object, the method’s body implicitly uses keyword
________ to refer to the object’s instance variables and other methods.
4.7 ________ are stored in an array of String.
4.8 Methods (called functions or procedures in some languages) help you ________ a program by separating
its tasks into self-contained units.
4.9 If the ________ is to a variable, first the variable is incremented by 1, then its new value is used in the
expression.
4.10 ________ instance variables are initialized by default to the value null.


PART TWO
(Answer any FOUR questions)

5.
a) What is Lifetime of Variables? Explain with example.
b) What advantage do Java's layout managers provide over traditional windowing systems?
What are the problems faced by Java programmers who don't use layout managers?
c) Constructor declarations are very much like method declarations. List the constraints which
are applied on constructor compared to methods. Write the example of constructor overloading.
(5+5+5)
6.
a) What is an identifier? List the examples of identifier.
b) Draw class model (diagram) for rail reservation system. The classes should show their attributes, and their operations. Also show the relationships between classes.
c) A class declaration introduces a new reference type. Write the general syntax of class declaration.
(3+6+6)
7.
a) Write a short note on method overriding.
b) What are an abstract method, a static method and a protected method?
c) What is an Exception Propagation?Differentiate checked and unchecked exception.
(4+6+5)
8.
a) What is aggregation? Explain how java supports it.
b) How the object oriented approach helps us keep complexity of software development under control? What is polymorphism?
c) How are this and super used with constructor? How is it possible for two String objects with
identical values not to be equal under the = = operator?
(4+6+5)
9.
a) Write a java program to demonstrate how to solve the producer consumer problem using
thread.
b) Explain the various types of classes using suitable example.
c) What is Object Oriented Programming (OOP)? Describe the principles of OOP. Explain the
Encapsulation principle.
(7+4+4)
Download PDF