Placement Papers — HCL Questions
TCS, Infosys, Wipro, Cognizant actual papers
21 Questions 12 Topics Take Test
Advertisement
Showing 1–10 of 21 questions in HCL Questions
Q.1 Medium HCL Questions HCL
What is the output of this code snippet? int x = 5; int y = ++x + x++ + x; System.out.println(x); System.out.println(y);
A x=7, y=18
B x=7, y=19
C x=8, y=19
D x=8, y=20
Correct Answer:  C. x=8, y=19
EXPLANATION

Starting with x=5. ++x increments x to 6 and returns 6. x++ uses 6 and then increments x to 7. The third x uses 7. So y = 6 + 6 + 7 = 19. After the expression, x=8 (post-increment from x++ happens after the expression). Final: x=8, y=19.

Take Test
Q.2 Medium HCL Questions HCL
If COMPUTER is coded as FRPSXGVQ, how is KEYBOARD coded?
A Nvernmyno
B NEYERMYNO
C NEYERMONO
D MEYERMONO
Correct Answer:  B. NEYERMYNO
EXPLANATION

Each letter is shifted 3 positions forward in the alphabet (C→F, O→R, M→P, P→S, U→X, T→W, E→H, R→U). Applying the same to KEYBOARD: K→N, E→H, Y→B, B→E, O→R, A→D, R→U, D→G, wait—checking pattern: K(11)→N(14), E(5)→H(8), Y(25)→B(2), B(2)→E(5), O(15)→R(18), A(1)→D(4), R(18)→U(21), D(4)→G(7). KEYBOARD→NEYERMYNO confirms the +3 shift with wraparound.

Take Test
Q.3 Medium HCL Questions HCL
What does MVC stand for in web development?
A Model View Controller
B Main Virtual Code
C Multiple Variable Control
D Memory View Cache
Correct Answer:  A. Model View Controller
EXPLANATION

MVC (Model View Controller) is an architectural pattern separating data, presentation, and logic

Take Test
Q.4 Medium HCL Questions HCL
Which of the following best describes a compiler?
A Executes code line by line
B Translates entire source code to machine code before execution
C Debugs code
D Stores code
Correct Answer:  B. Translates entire source code to machine code before execution
EXPLANATION

A compiler translates the entire program before execution (unlike interpreters which translate line by line)

Take Test
Q.5 Medium HCL Questions HCL
What is the default access modifier in Java?
A public
B private
C protected
D package-private
Correct Answer:  D. package-private
EXPLANATION

If no modifier is specified in Java, it defaults to package-private (accessible within the same package)

Take Test
Q.6 Medium HCL Questions HCL
What is encapsulation in OOP?
A Writing code in packages
B Bundling data and methods together while hiding internal details
C Creating new objects
D Sorting data
Correct Answer:  B. Bundling data and methods together while hiding internal details
EXPLANATION

Encapsulation is bundling data (variables) and methods together while hiding implementation details

Take Test
Q.7 Medium HCL Questions HCL
Which sorting algorithm has the best average time complexity?
A Bubble sort
B Quick sort
C Linear sort
D Selection sort
Correct Answer:  B. Quick sort
EXPLANATION

Quick sort has average time complexity O(n log n), better than bubble sort O(n²)

Take Test
Q.8 Medium HCL Questions HCL
Which of the following is NOT a cloud service model?
A SaaS
B PaaS
C IaaS
D DaaS
Correct Answer:  D. DaaS
EXPLANATION

SaaS (Software as Service), PaaS (Platform as Service), IaaS (Infrastructure as Service) are main cloud models. DaaS is Data as Service but not standard

Take Test
Q.9 Medium HCL Questions HCL
What is the main difference between an array and a linked list?
A Arrays are slower
B Arrays use continuous memory; linked lists use scattered memory
C Linked lists can only store numbers
D Arrays are always smaller
Correct Answer:  B. Arrays use continuous memory; linked lists use scattered memory
EXPLANATION

Arrays allocate continuous memory blocks; linked lists use nodes scattered in memory

Take Test
Q.10 Medium HCL Questions HCL
Rearrange: PLUOITCMAC. What word is formed?
A COMPLAINT
B COMPLIANT
C COMMUNION
D COMPUTE
Correct Answer:  B. COMPLIANT
EXPLANATION

PLUOITCMAC rearranged = COMPLIANT (meaning willing/agreeable)

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips