Skip to content

HCL Coding Questions - Programming Logic & Hands-on Coding Problems

Practice HCL placement paper coding questions with detailed solutions. Access HCL programming logic questions and hands-on coding problems.

This page contains HCL coding questions from HCL placement papers with detailed solutions.

HCL Online Assessment Coding Section:

  • Problems: 1-2 coding problems
  • Time: 25 minutes
  • Languages: C, C++, Java, Python
Q1: Find the maximum element in an array.

Solution (C++):

#include <iostream>
#include <climits>
using namespace std;
int findMax(int arr[], int n) {
int max = INT_MIN;
for (int i = 0; i < n; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
return max;
}

Time Complexity: O(n)

Q2: Reverse a string.

Solution (Java):

public String reverseString(String s) {
StringBuilder sb = new StringBuilder(s);
return sb.reverse().toString();
}

Time Complexity: O(n)


Practice HCL coding questions regularly!