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? public class Q1 extends Thred { public void run () { System.out.println( “Before start method”); this.stop(); } public static void main (String [] args) { Q1 a = new Q1 (); a.start (); } } a) Compilation error at line 7 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

Suggestion Paper for IT 501 - Object Technology & UML

Embed Size (px)

Citation preview

8/8/2019 Suggestion Paper for IT 501 - Object Technology & UML

http://slidepdf.com/reader/full/suggestion-paper-for-it-501-object-technology-uml 1/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?

public class Q1 extends Thred{

public void run ()

{

System.out.println(“Before start method”);

this.stop();

}

public static void main (String [] args)

{

Q1 a = new Q1 ();

a.start ();}

}

a)  Compilation error at line 7

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

v)  In which class is the wait () method defined?

a)  Applet c) Thread

b)  Runnable d) Object

8/8/2019 Suggestion Paper for IT 501 - Object Technology & UML

http://slidepdf.com/reader/full/suggestion-paper-for-it-501-object-technology-uml 2/4

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”);

}

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

a)  int c) object

b)  double d) byte

ix)  Which one of the following is a valid declaration of an applet?

a)  Public class MyApplet extends java.applet.Applet {

b)  Public Applet MyApplet {

c)  Public class MyApplet extends applet implements Runnable {

d)  Abstract class MyApplet extends applet implements Runnable {

e) 

Class MyApplet implements Applet {x)  Which of the options matches the following line:

a)  method c) message

b)  inheritance d) polymorphism

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

8/8/2019 Suggestion Paper for IT 501 - Object Technology & UML

http://slidepdf.com/reader/full/suggestion-paper-for-it-501-object-technology-uml 3/4

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 {

private int a;

public A (int a1) {

a = a1;

}

public void print (int data) {

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

}

}

class B extends A {

public B (int b1) {

super (b1);

}

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?

8/8/2019 Suggestion Paper for IT 501 - Object Technology & UML

http://slidepdf.com/reader/full/suggestion-paper-for-it-501-object-technology-uml 4/4

 

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?

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?

11. a) What are Java “thread” and “monitor” ?

b) Distinguish between “dynamic binding” and “Message passing”.

c) What is “Template” and “Package” with example.

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.

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’.