Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

​HCL Technical Questions and Answers with Explanation

1.​ In C, if you pass an array as an argument to a function, what actually gets passed?

A.The first element of the array


B.The base address of the array
C.Address of the last element of an array
D.Value of elements in an array

Answer -​ B. Base address of the array


Explanation:
When we pass an array as a function argument, the base address of the array will be
passed.

2.​ What will happen if in a C program you assign a value to an array element whose
subscript exceeds the size of an array?

A. The element will be set to 0.


B. The compiler would report an error.
C. The program may crash if some important data gets overwritten.
D. The array size would appropriately grow.

Answer -​ C. The program may crash if some important data gets overwritten
Explanation:
If the index of the array size is exceeded, the program will crash. But modern compilers will
take care of this kind of errors.

3.​ What does the following declaration mean?


int (*ptr)[10];

A. ptr is a pointer to an array of 10 integers


B. ptr is an array of 10 integers
C. ptr is an array of pointers to 10 integers
D. ptr is a pointer to an array

Answer -​ A. ptr is a pointer to an array of 10 integers


Explanation:​ However, ptr is a pointer to an array of 10 integers

4.​ Which of the following is not an OOP language?

A. C
B. C++
C. Java

​https://www.freshersnow.com/placement-papers-download/
​HCL Technical Questions and Answers with Explanation

D. Python

Answer -​ Option A.
Explanation:​ C is not an object-oriented language

5.​ Which of the following is not a Script Programming language?

A. PHP
B. Ruby
C. Perl
D. JavaScript
E. None of the Above

Answer -​ E. None of the Above


Explanation:​ All the options are Script Programming Languages

6.​ Which of the following statements should be used to obtain a remainder after dividing 3.14
by 2.1?

A. rem = modf(3.14, 2.1);


B. rem = fmod(3.14, 2.1);
C. rem = 3.14 % 2.1;
D. Remainder cannot be obtain in floating point division.

Answer -​ B. rem = fmod(3.14, 2.1);


Explanation:
fmod(x,y) - Calculates x modulo y, the remainder of x/y. This function is the same as the
modulus operator. But fmod() performs floating point divisions.

7.​ Which of the following allows function overloading in C++?

A. Type
B. Number of arguments
C. Both (A) and (B)
D. None of these

Answer -​ C. Both (A) and (B)


Explanation:
Both type and number of arguments can be overloaded.

8.​ In C, if you pass an array as an argument to a function, what actually gets passed?

​https://www.freshersnow.com/placement-papers-download/
​HCL Technical Questions and Answers with Explanation

A. Value of elements in an array


B. The first element of the array
C. The base address of the array
D. Address of the last element of an array

Answer -​ C. Base address of the array


Explanation:
The statement 'C' is correct. When we pass an array as a function argument, the base
address of the array will be passed.

9.​ Which of the following real-world scenarios would you associate with a stack data
structure?

A. Piling up of chairs one above the other


B. People standing in a line to be serviced at a counter
C. Offer services based on the priority of the customer
D. All of the mentioned

Answer -​ A. Piling up of chairs one above the other


Explanation:​ Stack follows Last In First Out(LIFO) policy. Piling up of chairs one above the
other is based on LIFO, people standing in a line is a queue and if the service is based on
priority, then it can be associated with a priority queue.

10.​ What does ‘stack underflow’ refer to?

A. Accessing item from an undefined stack


B. Adding items to a full stack
C. Removing items from an empty stack
D. Index out of bounds exception

Answer -​ C. Removing items from an empty stack


Explanation:​ Removing items from an empty stack is termed as stack underflow.

11.​ What is the time complexity of pop() operation when the stack is implemented using an
array?

A. O(1)
B. O(n)
C. O(log n)
D. O(n log n)

​https://www.freshersnow.com/placement-papers-download/
​HCL Technical Questions and Answers with Explanation

Answer -​ A. O(1)
Explanation:​ pop() accesses only one end of the structure, and hence constant time.

12.​ Which of the following is a true about Binary Trees

A. Every binary tree is either complete or full.


B. Every complete binary tree is also a full binary tree.
C. Every full binary tree is also a complete binary tree.
D. No binary tree is both complete and full.
E. None of the above

Answer:​ E. None of the above


Explanation:​ A full binary tree (sometimes a proper binary tree or 2-tree or strictly binary
tree) is a tree in which every node other than the leaves has two children.

13.​ Database is generally __________

A. System-centered
B. User-centered
C. Company-centered
D. Data-centered

Answer -​ B. User-centered
Explanation:​ Database is user-centered. The perspective is that the user is always right. If
there is a problem with the use of the system, the system is the problem, not the user.

14.​ A characteristic of an entity.

A. Relation
B. Attribute
C. Parameter
D. Constraint

Answer -​ B. Attribute
Explanation:​ An attribute is a characteristic of an entity. The association among the entities
is described by the relationship.

15.​ The restrictions placed on the data.


A. Relation
B. Attribute

​https://www.freshersnow.com/placement-papers-download/
​HCL Technical Questions and Answers with Explanation

C. Parameter
D. Constraint
Answer -​ D. Constraint
Explanation:​ Constraint is a restriction that is placed on the data. The attribute is the
characteristic and the relation describes the association.

​https://www.freshersnow.com/placement-papers-download/

You might also like