HCL Question Paper : November 2014 Set : 5
Question
Array
Linked List
Both Array and Linked List
Merge Sort can be implemented using constant space irrespective of the implementing data structure
Merge Sort requires O(n) space when implemented using __________ .
Fill in the blank
Passage:
For solving a problem, which of these is the first step in developing a working program
for it?
Question
Writing the program in the programming language
Writing a step-by-step algorithm to solve the problem.
Compiling the libraries required.
Code debugging
Passage:
Mary is making a database of animals in a zoo and their properties. The possible
animals are dog, lion and zebra. Each one has as attributes isHerbivorous, colour and
isNocturnal. She uses the object oriented programming paradigm for this. How will she
conceptualize the system?
Question
class: Animal; objects: dog, lion and zebra; data members:
isHerbivorous, colour and isNocturnal
class: Animal; objects: isHerbivorous, colour and isNocturnal; data
members: dog, lion and zebra
classes: dog, lion and zebra; objects: Animal; data members:
isHerbivorous, colour and isNocturnal
None of these
Null function is also known as _________ .
Fill in the blank
Question
Anonymous Function
Generic Function
Void Function
Null Operator
Which of the following options refers to the worst case while sorting elements in a Binary Search tree?
Question
Random elements with last element having the largest value
Data input lies within 0 to 100
Data input is sorted(in order)
First data input element is the lowest and the last one is the largest in value.
Parthiv has included several classes and their objects in his project. Now he wants to use something that will hold all these objects(of different
classes). Which of the following options provides him with the best alternate?
Question
Store them in database
Final Class
Generic Class
Anonymous Class
Passage:
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?
Question
Code B is better because variable names are shorter
Code A is better because the variable names are understandable
and non-confusing
Code A will run correctly, while Code B will give an error.
Code B will run correctly, while Code A will give an error.
Question
It is known as variant
Only one data type is used at a time
It holds values of variable sized different data types
The tag field determines which data type is being currently used
Which of the following statements is not true about tagged Union?
Passage:
How can a call to an overloaded function be ambiguous?
Question
By misspelling the name
There might be two or more functions with the same name
There might be two or more functions with equally appropriate
signatures
None of these
Question
Any function can be made and marked as starting point using a language dependent syntax
Two macros can be used. One to hold the name of a function and its working and the other to call the first macro
Any program without a main function shall not do anything but can only produce a blank screen
It is not possible to run a program without a main function in a program
Function main is the starting point of execution of a program. Which of the following options shall help in making an executable program without the
use of main function in the program?
Passage:
Smriti wants to make a program to print the sum of square of the first 5 whole numbers
(0...4). She writes the following program:
integer i = 0 // statement 1
integer sum = 0 // statement 2
while ( i < 5 ) // statement 3
{
sum = i*i // statement 4
i = i + 1 // statement 5
}
print sum // statement 6
Is her program correct? If not, which statement will you modify to correct it?
Question
No error, the program is correct.
Statement 1
Statement 4
statement 6
Passage:
Consider a binary tree implementation. The root address is stored in the variable root.
Given the address of a node in variable node, its value, right and root child node
address can be accessed using the following statements respectively: node-> value,
node -> right, node-> left. Srikanth writes the following function to do a preorder
traversal of the tree.
function preordertraverse(node)
{
print node -> value
if (Condition X)
{ preordertraverse(node->left) }
if (Condition Y)
{ preordertraverse(node->right) }
return
}
What is condition X and Condition Y?
Question
Condition X: node -> left isnotequal null
Condition Y: node -> right isnotequal null
Condition X: node -> right isnotequal null
Condition Y: node -> left isnotequal null
Condition X: node -> left isequal null
Condition Y: node -> right isequal null
Condition X: node -> right isequal null
Condition Y: node -> left isequal null
Passage:
Afzal writes a piece of code, where a set of three lines occur around 10 times in
different parts of the program. What programming concept can he use to shorten his
program code length?
Question
Use for loops
Use functions
Use arrays
Use classes
Deep needs to implement a Linked List for his project. He needs to bring out the given operations on the list.
1. Deleting the first element of the list.
2. Inserting a new element as a first element.
3. Deleting the last element of the list.
4. Adding a new element at the end of the list.
If Deep has the access to the pointers to the first and last elements in a Linked List, then which of the given operations that he performs is dependent
on the length of the list?
Question
Only 1
Only 3
Both 1 and 2
Both 3 and 4
What is the term given to the concept of binding an object with its identifier?
Question
Dynamic Binding
Name Binding
Dynamic Dispatching
Name Dispatching
Passage:
What is space complexity of a program?
Question
Amount of hard-disk space required to store the program
Amount of hard-disk space required to compile the program
Amount of memory required by the program to run
Amount of memory required for the program to compile
Passage:
Shahaana has a 10,000 line code. She is trying to debug it. She knows there is a
logical error in the first 25 lines of the code. Which of the following options will be an
efficient way of debugging?
Question
Compile the whole code and step into it line by line
Use an interpreter on the first 25 lines.
Compile the whole code and run it
None of these
Which of the following statements is not true in the context of anonymous Union data type?
Question
It is a Union that does not have any name
It is not followed by a declarator
It defines an unnamed object
It defines a data type
Passage:
Which of the following sorting algorithms yield approximately the same worst-case and
average-case running time behaviour in O (n log n)?
Passage:
As part of the maintenance work, you are entrusted with the work of rearranging the
library books in a shelf in proper order, at the end of each day. The ideal choice will be Question
Bubble Sort
Insertion Sort
Selection Sort
Heap Sort
Array
Linked List
Both Array and Linked List
Merge Sort can be implemented using constant space irrespective of the implementing data structure
Merge Sort requires O(n) space when implemented using __________ .
Fill in the blank
Passage:
For solving a problem, which of these is the first step in developing a working program
for it?
Question
Writing the program in the programming language
Writing a step-by-step algorithm to solve the problem.
Compiling the libraries required.
Code debugging
Passage:
Mary is making a database of animals in a zoo and their properties. The possible
animals are dog, lion and zebra. Each one has as attributes isHerbivorous, colour and
isNocturnal. She uses the object oriented programming paradigm for this. How will she
conceptualize the system?
Question
class: Animal; objects: dog, lion and zebra; data members:
isHerbivorous, colour and isNocturnal
class: Animal; objects: isHerbivorous, colour and isNocturnal; data
members: dog, lion and zebra
classes: dog, lion and zebra; objects: Animal; data members:
isHerbivorous, colour and isNocturnal
None of these
Null function is also known as _________ .
Fill in the blank
Question
Anonymous Function
Generic Function
Void Function
Null Operator
Which of the following options refers to the worst case while sorting elements in a Binary Search tree?
Question
Random elements with last element having the largest value
Data input lies within 0 to 100
Data input is sorted(in order)
First data input element is the lowest and the last one is the largest in value.
Parthiv has included several classes and their objects in his project. Now he wants to use something that will hold all these objects(of different
classes). Which of the following options provides him with the best alternate?
Question
Store them in database
Final Class
Generic Class
Anonymous Class
Passage:
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?
Question
Code B is better because variable names are shorter
Code A is better because the variable names are understandable
and non-confusing
Code A will run correctly, while Code B will give an error.
Code B will run correctly, while Code A will give an error.
Question
It is known as variant
Only one data type is used at a time
It holds values of variable sized different data types
The tag field determines which data type is being currently used
Which of the following statements is not true about tagged Union?
Passage:
How can a call to an overloaded function be ambiguous?
Question
By misspelling the name
There might be two or more functions with the same name
There might be two or more functions with equally appropriate
signatures
None of these
Question
Any function can be made and marked as starting point using a language dependent syntax
Two macros can be used. One to hold the name of a function and its working and the other to call the first macro
Any program without a main function shall not do anything but can only produce a blank screen
It is not possible to run a program without a main function in a program
Function main is the starting point of execution of a program. Which of the following options shall help in making an executable program without the
use of main function in the program?
Passage:
Smriti wants to make a program to print the sum of square of the first 5 whole numbers
(0...4). She writes the following program:
integer i = 0 // statement 1
integer sum = 0 // statement 2
while ( i < 5 ) // statement 3
{
sum = i*i // statement 4
i = i + 1 // statement 5
}
print sum // statement 6
Is her program correct? If not, which statement will you modify to correct it?
Question
No error, the program is correct.
Statement 1
Statement 4
statement 6
Passage:
Consider a binary tree implementation. The root address is stored in the variable root.
Given the address of a node in variable node, its value, right and root child node
address can be accessed using the following statements respectively: node-> value,
node -> right, node-> left. Srikanth writes the following function to do a preorder
traversal of the tree.
function preordertraverse(node)
{
print node -> value
if (Condition X)
{ preordertraverse(node->left) }
if (Condition Y)
{ preordertraverse(node->right) }
return
}
What is condition X and Condition Y?
Question
Condition X: node -> left isnotequal null
Condition Y: node -> right isnotequal null
Condition X: node -> right isnotequal null
Condition Y: node -> left isnotequal null
Condition X: node -> left isequal null
Condition Y: node -> right isequal null
Condition X: node -> right isequal null
Condition Y: node -> left isequal null
Passage:
Afzal writes a piece of code, where a set of three lines occur around 10 times in
different parts of the program. What programming concept can he use to shorten his
program code length?
Question
Use for loops
Use functions
Use arrays
Use classes
Deep needs to implement a Linked List for his project. He needs to bring out the given operations on the list.
1. Deleting the first element of the list.
2. Inserting a new element as a first element.
3. Deleting the last element of the list.
4. Adding a new element at the end of the list.
If Deep has the access to the pointers to the first and last elements in a Linked List, then which of the given operations that he performs is dependent
on the length of the list?
Question
Only 1
Only 3
Both 1 and 2
Both 3 and 4
What is the term given to the concept of binding an object with its identifier?
Question
Dynamic Binding
Name Binding
Dynamic Dispatching
Name Dispatching
Passage:
What is space complexity of a program?
Question
Amount of hard-disk space required to store the program
Amount of hard-disk space required to compile the program
Amount of memory required by the program to run
Amount of memory required for the program to compile
Passage:
Shahaana has a 10,000 line code. She is trying to debug it. She knows there is a
logical error in the first 25 lines of the code. Which of the following options will be an
efficient way of debugging?
Question
Compile the whole code and step into it line by line
Use an interpreter on the first 25 lines.
Compile the whole code and run it
None of these
Which of the following statements is not true in the context of anonymous Union data type?
Question
It is a Union that does not have any name
It is not followed by a declarator
It defines an unnamed object
It defines a data type
Passage:
Which of the following sorting algorithms yield approximately the same worst-case and
average-case running time behaviour in O (n log n)?
Passage:
As part of the maintenance work, you are entrusted with the work of rearranging the
library books in a shelf in proper order, at the end of each day. The ideal choice will be Question
Bubble Sort
Insertion Sort
Selection Sort
Heap Sort
0 comments:
Post a Comment