July, 2010
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 “tear-off” answer sheet attached to the question paper, following
instructions therein. (1x10)
1.1 The minimum value of char type variable is
A) ‘\u0020’
B) ‘\u00ff’
C) ‘ ’
D) ‘\u0000’
1.2 Which of the following is correct?
A) int a = 16, a>>2 = 4
B) int b = -8, b>>1 = -4
C) int a = 16, a>>>2 = 4
D) All of the above
1.3 Consider the following code
if ( number >= 0)
if (number > 0)
System.out.println(“Number is positive”);
else
System.out.println(“Number is negative”);
What will be the output if number is equal to 0?
A) Number is negative
B) Number is positive
C) Both A) and B)
D) None of the above
A10.1-R4 (New) Page 2 of 5 July, 2010
1.4 What is the error in the following class definition?
abstract class MyTest
{
abstract sum (int x, int y) { }
}
A) Class header is not defined properly
B) Constructor is not defined
C) Method is not defined properly
D) No error
1.5 Consider the following class definitions:
class mathstest
{
Student student1;
}
class Student
{
String name;
}
This code represents:
A) an ‘is a’ relationship
B) a ‘has a’ relationship
C) both
D) neither
1.6 Which of the following methods belong to the String class?
A) length( )
B) compareTo()
C) equals( )
D) All of the above
1.7 When repaint( ) is invoked for a component, the AWT invokes the ________ method.
A) draw( )
B) update( )
C) paint( )
D) show( )
1.8 Partitions in activity diagram are basically known as ________.
A) Grouplens
B) Swimlens
C) Workflow
D) None
1.9 The deployment diagram represents ________ view of a use case model.
A) Physical
B) Logical
C) Process
D) All
1.10 The setBackground( ) method is part of the class ________.
A) Graphics
B) Applet
C) Component
D) Container
2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “tear-off” sheet attached to the question paper, following instructions therein. (1x10)
the calling HTML page.
2.2 It is possible to use the File class to list the contents of the current working directory.
2.3 If a frame uses a GridLayout manager and does not contain any panels, then all the
components within the frame are of the same width and height.
2.4 An abstract class can be final also.
2.5 Exceptions can be caught or rethrown to a calling method.
2.6 Subclasses’ methods can access all members/ attributes of the superclass.
2.7 The Vector class provides the capability to implement a growable array of objects.
2.8 In Java, an array can store different types of values.
2.9 In UML, Component structure diagram shows process view of the use case model.
2.10 A parameterized class is actually not a class, it is a template.
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 “tear-off” answer sheet attached to the question paper, following instructions therein. (1x10)
X
|
Y
|
||
3.1
|
Random class
|
A.
|
abstract
|
3.2
|
A javadoc
tag which is used to denote a comment for a method parameter
|
B.
|
Association
|
3.3
|
A method
used to output a string to an applet
|
C.
|
java.lang package
|
3.4
|
A component generates an action event
|
D.
|
@argument
|
3.5
|
createStatement() method
|
E.
|
Interaction
|
3.6
|
bytecode file
|
F.
|
finalize( )
|
3.7
|
garbage collection
|
G.
|
@param
|
3.8
|
System.in
|
H.
|
Button
|
3.9
|
Aggregation
|
I.
|
drawstring( )
|
3.10
|
Collaboration
|
J.
|
PreparedStatement
|
|
|
K.
|
Statement
|
|
|
L.
|
.class extension
|
|
|
M.
|
.java extension
|
|
|
N.
|
writeString( )
|
|
|
O.
|
InputStream
|
|
|
P.
|
java.io package
|
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 “tear-off” answer sheet attached to the question paper, following instructions therein. (1x10)
A.
|
flush( )
|
B.
|
java.util
|
C.
|
Unicode
|
D.
|
clearbuffer( )
|
E.
|
Graphics
|
F.
|
Java.lang
|
G.
|
listener
|
H.
|
class variable
|
I.
|
JFrame
|
J.
|
static
|
K.
|
Object
|
L.
|
Panel
|
M.
|
Map
|
N.
|
instance variable
|
O.
|
Applets
|
P.
|
Country
|
Q.
|
Locale
|
R.
|
Dynamic
|
4.1 Java uses ________ character set.
4.2 StringTokenizer class is available in ________ package.
4.3 A paint( ) method of an applet has a parameter of type ________.
4.4 In java, ________ class is the root of class hierarchy.
4.5 Static variable is also called ________.
4.6 Frame class is the immediate superclass of ________.
4.7 The ________ method helps in clearing the buffer.
4.8 Method overloading is an example of ________ method binding.
4.9 Multimedia applications can be designed in JAVA using ________.
4.10 ________ class of java.util package supports internationalization.
PART TWO
(Answer any FOUR questions)
a) Differentiate between an interface and an abstract class.
b) Write an applet that draws a circle every time the mouse button is clicked. Set the radius of the
circle to 6 pixels.
c) Briefly explain the three main concepts of Object Oriented Programming Paradigm.
(5+5+5)
6.
a) Discuss method overloading and method overriding with suitable example.
b) Explain constructors. Why they should not be declared private?
c) List types of JDBC drivers. Explain any two of them.
(5+5+5)
7.
a) What is an applet? Explain life cycle of an applet.
b) Describe event delegation model
c) Briefly explain following command-line tools available in Java.
i) javac
ii) java
iii) appletviewer
iv) javadoc
v) javap
(5+5+5)
8.
a) What are packages and how are they useful?
b) Write a brief note on following types of diagrams in UML.
i) Sequence Diagrams
ii) Activity Diagrams
c) In a class hierarchy, in which order are the constructors for the classes that make up the
hierarchy are called? How can a specific parameterized constructor of the superclass be called
by the subclass?
(5+5+5)
9.
a) What do you mean by UML USE case diagrams? Explain book issue and return process of
Library Management System with USE case diagrams.
b) Distinguish between throw and throws with the help of examples.
c) What are UML class diagrams? What is generalization relationship? Explain it with suitable
example.
(5+5+5)
Next Set
No comments:
Post a Comment