Thursday, October 19, 2006

OPAD QUIZ QUESTIONS

OPAD MAIN QUIZ

HELD ON 16TH OCT'06
(BASED ON MEMORY)
Duration: 2hrs


1. The class Testing is saved in a file named as "Test.java". What will happen when we compile Test.java
public class Testing
{
public static void main(String[] args)
{
System.out.println("Testing Program");
}
}

a> Will give compilation Error
b> Prints Testing Program
c> Compiles Successfully
d> Runtime Error


2. It was based on Clone Method
class A implements Clonable
{
p s v m(String[] args)
{
System.out.println("Clone Method");
}
}

Clone not Supported Exception



3. Give the output of the code given below

class A
{
p s v m(String[] args)
{
System.out.print("Main1");
}
static public void main(String[] args)
{
System.out.print("Main2");
}
}

a> Main1
b> Main2
c> Main1 followed by Main2
d> Runtime Error

4. What is the value of variable count

class hello
{
public int count=0;
void check(int a)
{
if(a==0)
return;
else
{
a=a-1;
count++;
}
}

public static void main(String[] args)
{
hello h=new hello();
h.check(5);
System.out.println(count);
}
}


a>5 b> 6 c>4 d>0

5. Accessibility Sequence

public private protected default in the Ascending Sequence


6. How many rotations are needed to balance the AVL tree given

x
/
y
z
Give on which node and which rotation is needed i.e Left or Right

7. A sequence of integer is given construct an AVL tree and also give how many left rotations and how many right rotations
are needed during the construction of the tree.

8. What will be the output of the following code:
int a=5;
switch(a)
{
default: System.out.println("default");
case 5: System.out.print("Five");
case 10: System.out.print("Ten");
break;
}

a> Five Ten
b> default Five Ten
c> Ten
d> Five

9. There are two types of Heap namely Min Heap and Max Heap. You are given a sequence of integers and you have to identify
which one is not a heap.

10. A hash table uses the probing and two methods Chaining and one more
You have to tell in which method clusters are created

11. What will be the output of the following program
int a=11;
for(int i=0; i<3; i++)
// a=a+1;
a=a-1;
System.out.println(a);

a> 14
b> 8
c> 9
d> 10

12. A postorder sequence of given and you have to generate the preorder and tree is Binary

13. A preorder and inorder of the tree is given. Create the postorder of that tree.

14. A linklist is
a> link
b> a tree
c> a graph
d> both b and c

15. What will be the value in variable i:
double i=7/3;
a> 2.33333333
b> 2.0
c> 3
d> None of the above

16. What will be the output of the following code
class A
{
try
{
psvm(String[] args)
{

System.out.println("Try");
}
}
finally
{
int a=5/0;
System.out.println("Finally");
}
}

a> Try followed by error followed by Finally
b> Try followed by Arithmetic Exception
c> Try followed by Finally
d> None of the above

17. The hight of ACBT(Almost Complete Binary Tree) is given (5). The minimum no of nodes that tree can have

18. Find which one is not a Flow Augmented Path in the graph given

19. A Graph was given. Apply Prim's and Kruskal's Algorithms and give the output of each one of them

20. BufferedInputStream wraps with
a> FileInputStream
b> FileReader
c> ........
d> ........

21. What will be printed
Class A
{
int x;
psvm(String[] args)
{
A a1=new A();
a1.x=5;
A a2=new A();
a2=a1;
a2.x++;
System.out.println(a1.x);
}
}

a. 5
b. 6
c. 7
d. 4

22. Which one is correct to create a multidimensional array:
a> int a[][] = new int[5][5];
b> int a[3][3] = new int[5][5];
c> int a[3][3];
d> none

23. A doubly link list is as follows
A -----> B ---------> C
<----- <---------

Remove the B node without using the third variable

24. A DFS function was given .
What that function will return
a> PREORDER
b> INORDER
c> POSTORDER
d> None of the above


25. One question I din remember if you remember than please reply to me



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

No comments :

Post a Comment