Pages

Sunday, 9 April 2017

Java Solved Paper







NIELIT A Level Solve Paper
Core Java January, 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 is valid long literal?
A) 0x99fffL
B) ABCDEFG
C) 0x99fffa
D) 99671246

1.2 The essential characteristic of an object that distinguishes it from all other kinds of objects and
thus provides crisply defined conceptual boundaries, relative to the perspective of the viewer is
called:
A) Encapsulation
B) Modularity
C) Hierarchy
D) Abstraction
1.3 Which of following is an incorrect Statement?
A) It is necessary to use new operator to initialize an array.
B) Array can be initialized using comma separated expressions surrounded by curly braces.
C) Array can be initialized when they are declared.
D) None of the above
1.4 Which of the following keyword is used to refer to member of base class from a subclass?
A) upper
B) super
C) this
D) None of the above

1.5 What would be the output from the following code?
class A
{
    int i;
    void display()
   {
           System.out.println(i);
     }
}

class B extends A
{
   int j;
  void display()
 {
   System.out.println(j);
 }
}
class inheritance_demo
{
    public static void main(String args[])
   {
           A obj = new B();
           obj.i=1;
          //obj.j=2;
            obj.display();
    }
}
A) 0
B) 1
C) 2
D) Compilation Error
1.6 Which of the following is the process of defining a method in subclass having same name &
signature as a method in its superclass?
A) Method overloading
B) Method overriding
C) Method hiding
D) None of the mentioned
1.7 Which of these modifiers can be used for a variable so that it can be accessed from any thread
or parts of a program?
A) transient
B) volatile
C) global
D) None of the above
1.8 Which of this access specifies can be used for a class so that its members can be accessed by
a different class in the same package?
A) Public
B) Protected
C) Default
D) All of the above
1.9 Which of this method can be used to make the main thread to be executed last among all the
threads?
A) stop()
B) sleep()
C) join()
D) call()

1.10 What is synchronization in reference to a thread?
A) It’s a process of handling situations when two or more threads need access to a shared
resource.
B) It’s a process by which many thread are able to access same shared resource simultaneously.
C) It’s a process by which a method is able to access many different threads simultaneously.
D) It’s a method that allow too many threads to access any information require.

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 The expression (y >= z && a == b) is evaluated by first evaluating the expression y >= z, and
then evaluating a == b.
2.2 Consider the statement "x = (a > b) ? a : b"; then the value of x is 27, if a = 18 and b = 27.
2.3 A break statement must always be present in the default case of a "switch" selection structure.
2.4 A method that is overridden in the subclass must retain the same return type and parameter list.
2.5 A method in a class declared as static may be invoked simply by using the name of the method
alone.
2.6 All interface methods must be declared as public when implemented in a class.
2.7 Persistence saves the state and class of an object across time or space.
2.8 A value must always be assigned to String object when it is created, and cannot be modified
later.
2.9 The System.in and System.out objects are available by default and need not be created
explicitly.
2.10 An array in the Java programming language has the ability to store different types of values.

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
Late Binding
A.
Specialized class
3.2
Used for Instance Variable hiding
B.
Attribute and state
3.3
Variable declare inside the class but outside the method
C.
Method Overriding
3.4
All objects have
D.
Synchronization
3.5
Variable declare inside any method or any loop
E.
this
3.6
Cannot use any access specifier accept public
F.
Instance variable
3.7
Unchecked Exception
G.
Local variable
3.8
Inheritance in object-oriented modelling can be used to
H.
Interface
3.9
Used to avoid race condition among different parts of program
I.
Run time exception
3.10
Can use all the types of access specifier
J.
Abstract Class


K.
Method Overloading


L.
Static Variable


M.
Static class

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.
Abstract
B.
Public
C.
Throwable
D.
Exception
E.
Object
F.
Java
G.
Package
H.
main
I.
Static, Protected
J.
Bytecode
K.
Final
L.
Javac
M.
Executable code






4.1 Execution of a Java application begins at the ________ method.
4.2 Java source code is compiled into ________ which is platform independent.
4.3 Any user-defined exception class is a subclass of the ________ class.
4.4 Methods defined in an interface must be ________ and abstract.
4.5 A ________ is a collection of classes and interfaces.
4.6 ________ method is one which has no body and is meant to be overridden in every derived
class.
4.7 ________ command is used to convert java source code to bytecode.
4.8 Only subclasses of ________ class may be caught or thrown.
4.9 ________ keyword is used to restrict the inheritance in java.
4.10 In Java, array is implemented as ________.

PART TWO
(Answer any FOUR questions)

5.
a) Write a program (using java.util and java.io package) to create a zip file for the given contents.
b) Explain the types of inner classes available in Java.
(9+6)
6.
a) Differentiate checked and unchecked exception.
b) Explain event delegation model of an AWT programming.
c) What are aggression and composition in object oriented programming? Explain with suitable
example.
(3+8+4)
7.
a) What is meant by garbage collection? How is it done in Java?
b) What is the Java Virtual Machine? Differentiate java virtual machine and java run time
environment.
c) Explain Static and Dynamic binding with Example
(5+5+5)
8.
a) What is the difference between the Boolean & operator and the && operator?
b) Write a java program to read a file and count the total numbers of words and characters
available in it.
c) Draw the use case and activity diagram for ticket vending machine.
(2+6+7)
9.
a) Explain the types of jdbc driver. What is metadata interface and explain any two metadata
interfaces?
b) What is constructor overloading and method overloading? Explain the use of method overriding
in object oriented programming.
c) Explain following methods:
i) wait()
ii) notify()
iii) sleep()
(7+5+3)

Download PDF

No comments:

Post a Comment