You are on page 1of 4

IT 501 OBJECT TECHNOLOGY & UML

Multiple Choice Questions


1. Choose the correct alternatives for any ten of the following:
i) The method int func (int i, int j) { } can be overloaded using
A) int func (int i, int j, int j) { }
B) int func (float i, int j) { }
C) float func (int i, int j) { }
D) int func (int a, int b) { }
E) float func (int i, int j, float k) { }
a) (B) & (C) c) (A), (B), (C) & (E)
b) (C) & (D) d) (A), (B) & (E)
ii) What will happen if you compile / run this code?

om
public class Q1 extends Thred
{
public void run ()
{
t.c
System.out.println(“Before start method”);
this.stop();
}
bu
public static void main (String [] args)
{
Q1 a = new Q1 ();
yw

a.start ();
}
}
a) Compilation error at line 7
m

b) Runtime exception at line 7


c) Prints “Before start method” and “After stop method”
d) Prints “Before start method” only
iii) Which view shows how the various executables and other run-time components are
mapped to underlying platforms?
a) Logical view c) Deployment view
b) Implementation view d) Process view
iv) Exception is defined in …….. package
a) java.util c) java.awt
b) java.lang d)java.io
v) In which class is the wait () method defined?
a) Applet c) Thread
b) Runnable d) Object
vi) Aggregation (encapsulation) relationships are represented in the UML notation by
a) nesting of classes
b) lines with a solid diamond at one end
c) lines with a hollow diamond at one end
d) lines with an arrow at one end
e) lines without an arrow at either end
vii) What is an example of polymorphism?
a) Inner class c) Method overloading
b) Anonymous classes d) Method overriding
viii) switch (i) {

default:

System.out.println (“Hello”);

om
}

What is the acceptable type (s) for the variable i ?

a) int c) object
b) double
t.c d) byte
ix) Which one of the following is a valid declaration of an applet?
a) Public class MyApplet extends java.applet.Applet {
bu
b) Public Applet MyApplet {
c) Public class MyApplet extends applet implements Runnable {
d) Abstract class MyApplet extends applet implements Runnable {
yw

e) Class MyApplet implements Applet {


x) Which of the options matches the following line:
a) method c) message
b) inheritance d) polymorphism
m

xi) Relation name aggregation means


a) association between two logically unrelated classes
b) inheritance
c) Part – of
d) none of these
xii) Which view consists of few key scenarios or use-cases that are used to drive and
validate the architecture?
a) Logical view c) Deployment view
b) Implementation view d) Use-case view

Short Answer Type Questions


2. Differentiate between the following:
a. Abstract class and interface
b. Static and final keywords
c. Method overloading and method overriding
d. instant variable and class variable
e. Object and object reference
3. Discuss Applet life-cycle indicating the functions.
4. What is JVM? What do you mean by Java is a platform independent language?
5. a) Why do we overload a constructor? Explain
b) Explain what will be the output of the following code with justification:
public class test {
public static void main (string args []) {
B b = new b (10);
int c = b.print (20);
}
}
class A {

om
private int a;
public A (int a1) {
a = a1;
}
t.c
public void print (int data) {
System.out.println (“Result:” + data);

}
bu

class B extends A {
yw

public B (int b1) {

super (b1);
m

public int print (int data) {

System.out.println (“result:” + data);

return data;

6. What is the basic goal of UML? What do you mean by collaboration diagram?
7. What is the base class of Error and Exception? Differentiate between Error and Esception.

Long Answer Type Questions


8. What are the primary goals of UML? What is the difference between state chart diagram
and activity diagram? Model an activity diagram for the usecase of a driver starting a car.
Explain the sequence diagram and collaboration diagram with an example used in UML.
9. a) Differentiate between procedural oriented programming and object oriented
programming.
b) Why Java is called a ‘strongly typed’ language?
c) Differentiate between ‘up casting’ and ‘down casting’ with suitable examples.
d) What does the super keyword do?

om
10. a) What is multi-threading?
b) Write a program which can run a main thread and a child thread simultaneously.
c) Give a method that does not declare any exception. Can we override that method in a
subclass to throw an exception?
t.c
11. a) What are Java “thread” and “monitor” ?
bu
b) Distinguish between “dynamic binding” and “Message passing”.
c) What is “Template” and “Package” with example.
yw

12. a) What is meant by aggregation? And explain the different types of aggregation.
b) What are the differences between a sequence diagram and a collaboration diagram?
c) Draw object diagram for the following object classes, with association names attributes
and additional object classes if required.
m

Object classes: college, playground, principal, classroom, board, book, students, faculty,
cafeteria, ruler, door, swing.
d) Draw a sequence diagram for the cellular phone connection.
13. a) Describe different forms of inheritance with examples.
b) Why Java does not support multiple inheritance?
c) What is the difference between interface & abstract class? Implement Interface with a
sample code.
d) Distinguish between ‘Data Abstraction and ‘Encapsulation’.

You might also like