Professional Documents
Culture Documents
Exam Date: Wednesday 23rd March 2022 Time: 11:00 A.M Signature of CT:______________________________
Exam Duration: 1 Hour Max. Marks: 10 Marks awarded:
SECTION – A ( 4 x ½ = 2 Marks)
Answer ALL questions. Each question carries HALF mark
ii) The total number of comparisons required for sorting a list of n elements using selection sort algorithm is
______________.
iii) __________________ represents the fewest numbers of steps that an algorithm would require.
(a) Best Case complexity (b) Worst Case Complexity (c) Average Case Complexity (d) All of these
iv) Which of the following is a valid declaration of Java single dimensional array?
(a) int [ ] a = {1,2}; (b) int () a = [1,2]; (c) int a = {1,2}; (d) int a = [1,2];
SECTION – B (4 x 1 = 4 Marks)
Answer any FOUR questions. Each question carries ONE mark
A data structure is a particular way of storing and organizing data in a computer memory so that it can be used
efficiently.
int [ ] a = {1,2,3,4};
System.out.println(a[3]);
Output: 4
4. Show how selection sort works for the following list of elements?
126 43 25 1
126
1 43 25
126
1 25 43
126
1 25 43
A Circular linked list is a singly linked list in which the next reference of the tail node is set to refer back to the
head of the list (rather than null).
7. Explain the process of inserting an element at the head of a singly linked list with the help of a
suitable example.
Primitive types, such as the int type, are handled “by value.”
Nonprimitive types, such as arrays and classes, are handled “by reference.”
Whereas the variable of a primitive type holds the value of the variable, the variable of a nonprimitive type holds a
reference to the value of the variable.
That is, the variable holds the address where the system can find the value associated with the variable.
But, as you can see from figure, this is not the case with
reference types. When we assign Circle c2 to Circle c1, c1
does not become a copy of c2.