HCL Question Paper : November 2014 Set : 1

share facebook

Enter Your Email below to get Daily Job Alert in Your Mailbox



]]>
Passage:
Saloni writes the code for a function that takes as input n, an even integer and
calculates the sum of first n even natural numbers.
function sum( n )
{
if(n equals 2)
return 2
else
return (n + sum(n-2))
end
}
She then calls the function by the statement, sum(30). How many times will the function
sum be called to compute this sum?

Question
i) 1 ii) 30 iii) 15 iv) 16

What will be the Infix form of the given Postfix notation?
ABCD/+*

Question
i) A/B+C*D ii) A*(B+C)/D iii) A*(B+C/D) iv) A/(B+C*D)

Passage:
A destructor may be invoked in which of the following situations?
Question
i) When the object is created
ii) When the object is assigned value 0.
iii) Only at the end of the code
iv) When the scope of the object is over.

Question
Which of the following options is an exception to being a part of composite data types?

i) Union
ii) Array
iii) Structure
iv) Stack

Passage:
Ravi and Rupali are asked to write a program to sum the rows of a 2X2 matrices stored
in the array A.
Ravi writes the following code (Code A):
for n = 0 to 1
sumRow1[n] = A[n][1] + A[n][2]
end
Rupali writes the following code (Code B):
sumRow1[0] = A[0][1] + A[0][2]
sumRow1[1] = A[1][1] + A[1][2]
Comment upon these codes (Assume no loop-unrolling done by compiler):
Question
i) Code A will execute faster than Code B.
ii) Code B will execute faster than Code A
iii) Code A is logically incorrect.
iv) Code B is logically incorrect.

Passage:
A variable cannot be used...
Question
i) Before it is declared
ii) After it is declared
iv) In the function it is declared in
v) Can always be used

Passage:
In which area of a class are data and function directly accessible outside the class?
Question
i) Public
ii) Private
iii) Protected
iv) None of these



Passage:
Every element of a data structure has an address and a key associated with it. A search
mechanism deals with two or more values assigned to the same address by using the
key. What is this search mechanism?
Question
i) Linear Search
ii) Binary search
iii) Hash Coded Search
iv) None of these



Question
Which of the following options is equal to the complexity given as O(n log n)?

i) n O(log n)
ii) O(n!)
iii) O(log n!)
iv) O(n )



Passage:
A complete binary tree with 5 levels has how many nodes? (Root is Level 1)
Question
i) 15
ii) 25
iii) 63
31



Passage:
Which of the following abstract data types can be used to represent a many-to-many
relation?

Question
i) Tree
ii) Stack
iii) Graph
iv) Queue



Passage:
While calculating time complexity of an algorithm, the designer concerns
himself/herself primarily with the run time and not the compile time. Why?

Question
Run time is always more than compile time.
Compile time is always more than run time.
Compile time is a function of run time.
A program needs to be compiled once but can be run several times.

For the given array, find the arrangement of elements after 3rd pass of Selection Sort. Assume that the array is being sorted in ascending order.
List: 33, 22, 11, 77, 66, 88, 55

Question
i ) 22, 11, 33, 66, 77, 55, 88
ii) 11, 22, 33, 55, 66, 77, 88
iii) 11, 22, 33, 55, 66, 88, 77
iv) 11, 22, 33, 77, 66, 88, 55



Passage:
A linear list of elements in which deletion can be done from one end (front) and
insertion can take place at the other end (rear) is known as

Question
i) Queue
ii) Stack
iii) Tree
iv) Branch




Share on Google Plus
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment