HCL Question Paper : November 2014 Set : 2

share facebook

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

Zenab and Shashi independently write a program to find the the mass of one mole of
water, which includes mass of hydrogen and oxygen. Zenab defines the variables:
integer hydrogen, oxygen, water // Code A
while Shashi defines the three quantities as:
integer a, b, c // Code B
Which is a better programming practice and why?

i) Code B is better because variable names are shorter
ii) Code A is better because the variable names are understandable
and non-confusing
iii) Code A will run correctly, while Code B will give an error.
iv) Code B will run correctly, while Code A will give an error.

The algorithm design technique used in the quick sort algorithm is
i) Dynamic Programming
ii) Back Tracking
iii )Divide and Conquer
iv) Greedy Search

In an implementation of a linked list, each node contains data and address. Which of
the following could the address field possibly contain?

i) Address of next node in sequence
ii) It's own address
iii) Address of last node
iv) Address of first node

function MyBinarySearch(array arr, integer low, integer high, integer item)
if ( low > high )
return -1
integer mid = (low + high)/2
if ( arr[mid] equals item )
return mid
else if ( arr[mid] > item )
return //missing statement 1
return //missing statement 2
MyBinarySearch(arr, mid+1, high, item)
MyBinarySearch(arr, low+1, mid-1, item)
MyBinarySearch(arr, low, mid-1, item)
MyBinarySearch(arr, mid+1, high-1, item)
Harshul uses the given code to implement Binary Search
recursively. Find the statement that will replace missing
statement 2 in the given code such that it works efficiently.

Stuti is making a questionnaire of True-false questions. She wants to define a data-type
which stores the response of the candidate for the question. What is the most-suited
data type for this purpose?
i) integer
ii) boolean
iii) float
iv) character


Share on Google Plus
    Blogger Comment
    Facebook Comment


Post a Comment