0% found this document useful (0 votes)
14 views13 pages

Test Simulator

Uploaded by

a95912544
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views13 pages

Test Simulator

Uploaded by

a95912544
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

(Question 1 multiple choice)

1. Which Primtive Type of DS?


A) Intger
B) Static
C) Array
D) Vector
2. Which Non Primtive Type of DS?
A) Linear
B) Non Linear
C) A & B
D) All Answer is Correct
3. Which one Basic Operations?
A) Shift left
B) Shift Right
C) Sum And Average
D) All Answer is Correct
4. SPANNING TREES features it
A) Not cycle
B) Cycle
C) A & B
D) No Answer
5. What is a Bog(O):
for (inti = 0; i < n; i++) {
System.out.println(i);
}
A) O(n)
B) O(nlog(n))
C) O(nlog(n2))
D) O(1)
6. What is Big(O):
for(inti=1;i<=n;i++)
for(intj=1;j<=n;j=j*2)
A) O(n)
B) O(nlog(n))
C) O(1)
D) O(n2)

MeSH Edu I
7. Which method of the following does Clear the stack?
A) clear()
B) push()
C) pop()
D) topEl()
8. Which method of the following does Check to see if the stack is
empty?
A) Clear()
B) isEmpty()
C) push()
D) All Answer is Correct
9. Which method of the following does Return the topmost element
in the stack without removing it?
A) topEl()
B) isEmpty()
C) pop()
D) push()
10.What is worst case in Insertion Sort?
A) O(1)
B) O(n)
C) O(n2)
D) A & B
11.What is best case in Insertion Sort?
A) O(1)
B) O(n)
C) O(log(n))
D) O(n2)

12. What is worst, average and best case in Bubble Sort?


A) O(1)
B) O(n2)
C) O(n)
D) O(!n)

MeSH Edu II
13. What type of Data Sturucter do we use with Recursion?
A) Array List
B) Singly Linked List
C) Doubly Linked List
D) Stack
14. In Tree Terminologies A node's level is the number of edges along
the unique path between it and the root node. The level of the
root node is?
A) 0
B) 1
C) 2
D) 3
15.The empty tree is a legitimate tree of height is?
A) 3
B) 2
C) 1
D) 0
16.public static void main(String[] args) {
int n = 5;
int result = factorial(n);
System.out.println("The factorial of " + n + " is: " + result);}
public static int factorial(int n) {
if (n == 0 || n == 1) {
return 1;
} else {
return n * factorial(n - 1);}}
What is result of this?
A) 30
B) 60
C) 90
D) 120

17.Which of the following is a classic example of Recursion?


A) Tree
B) Factorial
C) Arrays
D) Link list
MeSH Edu III
18. public static void main(String[] args) {
int n = 4;
int r = 2;
int permutations = permutations(n, r);
System.out.println(permutations);
}
public static int permutations(int n, int r) {
return factorial(n) / factorial(n - r);
}
public static int factorial(int n) {
if (n == 0 || n == 1) {
return 1;
} else {
return n * factorial(n - 1);}}
What is result of this?
A) 2
B) 4
C) 8
D) 12
19. In B-Tree Properties Each leaf node holds …….. Keys?
A) k + 1
B) k – 1
C) K / 1
D) K * 1
20. The minimum number of fields in each node of as doublylinked
list is?
A) 2
B) 3
C) 4
D) 5

MeSH Edu IV
(Question Two Fill in the blanks)
1. A ………….. is a way of organizing data so that it can be used
effectively.
2. …………….. is the logical picture of the data and the operations to
manipulate the elements of the data.
3. Java’s …………….. is a useful language mechanism for processing an
abstract data.
4. To compare the efficiency of algorithms, a measure of the degree
of difficulty of an algorithm called ……………………..
5. The factor of …………… is usually more …………….. than that of space
6. If a node has a link only to its successor in the sequence of
nodes,the list is called a …………………….
7. A node includes two data fields: ……………. and ………………… .
8. The first node is always used as a reference to traverse the list and
is called…………….. .
9. The last node points to……………….
10. ………. and ………… operations have to be implemented as
operating methods on the stack
11. A queue is an ……………….. structure
12. ………… is the process of looking for a specific element in an array
13. The time complexity of this algorithm is ………………………
14. The best case insertion sort …………….
15. The worst case insertion sort ……………
16. The best case Selection sort ……………..
17.The Worst case Selection sort ……………..
18.The best, average and worst case Bubble sort ……………..
19.a function (let say fun) is called ……………… if it calls another
20. The best case Quick Sort ……………
21.The Worst case Quick Sort ……………
22. The Worst Case Merge Sort ……………….
23. The ………………… of a node is defined as the number of its children
24. The ……………… of a node is the length of the longest path from to
a leaf.
25. The ……………… of a nonempty tree is the maximum level of a node
in the tree. It is also the height of the root node in the whole tree.

MeSH Edu V
(Question Three short answers)

1. Write a Time Complexity with steps, if possible, for the following:


A) Int n = 1000;
System.out.println("Hey -your input is: " + n);

B) for (int i= 1; i< n; i= i* 2){


System.out.println("Hey -I'm busy looking at: " + i);
}.

C) for (int i = 0; i < n; i++) {


System.out.println(i);
}

D) for(int i=1;i<=n;i++)
for(int j=1;j<=n;j=j*2)
System.out.println(i+j);

E) for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
System.out.println(i+j);

2. Define the following:


A) HASH FUNCTIONS
B) Collison Resolution

MeSH Edu VI
(Question Four Long answers)

1. Write Bubble Sort Method for this data {9,6,0,7,2}

2. Write a Insertion sort method for this data {5,0,4,1,3}

3. Write a Selection sort method for this data {9,10,8,2,3}

MeSH Edu VII


4. Write me a simple program that calls the same function as
Factorial to multiply the first 4 numbers

5. Follow the figure to answer the questions

A) Depth E?
B) Level E?
C) Degree E?
D) Paht Length E?
E) Height E?
F) Depth L?
G) Level L?
H) Degree L?
I) Path Length L?
J) Height L?

MeSH Edu VIII


6. What is Binary Trees? Draw an example if you can and Mention all
three types?

7. Is this tree a complete tree or not? And why?

8. Choose any Two tree you want and fill out the following table
- Type of Tree ……………..

Type Tree Max Nodes Min Nodes Min height Max height

MeSH Edu IX
9. Write the name of the tree
A)

B)

10.Draw Binary Tree, use this data {13,10,25,2,12,20,31,29}


and use a (top-down, left to right)

MeSH Edu X
11. Building a B-tree of order 5 with the BTreeInsert() algorithm.
A) Insert 8, 14, 2, 15
B) Insert 3
C) Insert 1,16,6,5
D) Insert 27,37
E) Insert 18,25,7,13,20
F) Insert 22,23,24

MeSH Edu XI
12. Run DIJKSTRA’S ALGORITHM and find the shortest path from node
A to node F.

MeSH Edu XII


13.Follow This Keys {18,41,22,44,59,32,31,73} N=13 and:
A) Find h(k)
B) Find d(k)
C) Find Probes
D) Insert data in index

14.Follow This Keys {18,41,22,44,59,32,31,73} N=10 use Chaining

MeSH Edu XIII

You might also like