Capgemini Engineering
40+ Acro Technologies Interview Questions and Answers
Q1. Remove All Occurrences of a Character from a String
Given a string str
and a character 'X', write a function to remove all occurrences of 'X' from the given string.
If the character 'X' doesn't exist in the inp...read more
Create a function to remove all occurrences of a given character from a string.
Iterate through the string character by character and build a new string excluding the specified character.
Use a StringBuilder or similar data structure for efficient string manipulation.
Handle the case where the specified character does not exist in the input string.
Return the updated string after removing all occurrences of the specified character.
Q2. Detect Cycle in a Linked List
Given a singly linked list of integers, determine whether it contains a cycle. A cycle exists if any node in the list can be traversed more than once, forming a loop.
Input:
The fi...read more
Detect cycle in a singly linked list by using Floyd's Tortoise and Hare algorithm.
Use two pointers, slow and fast, to traverse the linked list.
If there is a cycle, the fast pointer will eventually meet the slow pointer.
Time complexity: O(N), Space complexity: O(1).
Q3. Quick Sort Problem Statement
You are provided with an array of integers. The task is to sort the array in ascending order using the quick sort algorithm.
Quick sort is a divide-and-conquer algorithm. It involve...read more
To achieve NlogN complexity in the worst case, we can implement the randomized quick sort algorithm.
Randomly select the pivot element to reduce the chances of worst-case scenarios.
Implement a hybrid approach like Introsort which switches to heap sort when the recursion depth exceeds a certain limit.
Use median-of-three partitioning to select a good pivot element.
Optimize the algorithm by choosing the right partitioning strategy and handling small subarrays efficiently.
Q4. Sort an Array of 0's, 1's, and 2's Problem Statement
Given an integer array ARR
of size 'N' containing only the values 0, 1, and 2, the task is to sort this array.
The goal is to achieve the sorting in a single...read more
Sort an array of 0's, 1's, and 2's in a single pass.
Use three pointers to keep track of 0's, 1's, and 2's positions while iterating through the array.
Swap elements based on the current element's value and the pointers.
Achieve sorting in a single pass by moving the pointers accordingly.
Q5. Reverse a Linked List Problem Statement
You are given a Singly Linked List of integers. Your task is to reverse the Linked List by changing the links between nodes.
Input:
The first line of input contains a sin...read more
Reverse a given singly linked list by changing the links between nodes.
Iterate through the linked list and reverse the links between nodes.
Keep track of the previous, current, and next nodes while reversing the links.
Update the head of the linked list to point to the last node after reversal.
Q6. Factorial Calculation Problem Statement
Develop a program to compute the factorial of a given integer 'n'.
The factorial of a non-negative integer 'n', denoted as n!
, is the product of all positive integers les...read more
Program to compute factorial of a given integer 'n', with error handling for negative values.
Create a function to calculate factorial using a loop or recursion
Check if input is negative and return 'Error'
Handle edge cases like 0 and 1 separately
Use long data type to handle large factorials
Example: For input 5, output should be 120
Q7. Level Order Traversal of Binary Tree
Given a binary tree of integers, return its level order traversal.
Input:
The first line contains an integer 'T' which represents the number of test cases. For each test cas...read more
Perform level order traversal on a binary tree and return the nodes in the order they are visited.
Use a queue to keep track of nodes at each level while traversing the tree.
Start with the root node, enqueue it, then dequeue and print its value, enqueue its children, and continue until the queue is empty.
Repeat the process for each level of the tree until all nodes are visited.
Example: For the input 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1, the output should be 1 2 3 4 5 6 7.
Q8. String to Pascal Case Conversion
Given a string STR
, the goal is to remove all spaces from the string and convert it to Pascal case. In Pascal case, there are no spaces between words, and each word begins with ...read more
Convert a string to Pascal case by removing spaces and capitalizing each word.
Remove spaces from the input string
Capitalize the first letter of each word
Combine the words to form the Pascal case string
Q9. Linked List Cycle Detection
Determine if a given singly linked list of integers forms a cycle.
Explanation:
A cycle in a linked list occurs when a node's next reference points back to a previous node in the lis...read more
Detect if a singly linked list forms a cycle by checking if a node's next reference points back to a previous node.
Use two pointers, one moving at double the speed of the other, to detect a cycle in the linked list.
If the fast pointer catches up to the slow pointer, there is a cycle.
Keep track of visited nodes to detect a cycle efficiently.
Q10. Delete Nth Node from End in a Linked List
Given a singly linked list with integer data and an integer K
, write a function to remove the Kth node from the end of the linked list.
Example:
Input:
The linked list ...read more
Remove the Kth node from the end of a singly linked list.
Use two pointers to find the Kth node from the end
Adjust pointers to remove the Kth node
Handle edge cases like deleting the head node or if K is out of bounds
Q11. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Understand the Merge Sort algorithm which involves dividing the array into two halves, sorting each half, and then merging them back together.
Recursively apply the Merge Sort algorithm until the base case of having single elements in the array is reached.
Merge the sorted halves to produce the final sorted array in non-descending order.
Ensure to handle the input constraints such as the number ...read more
Q12. What have you done on real implementation on linux OS?
I have implemented various software applications on Linux OS.
Developed a web application using Python Flask framework on Linux server
Created a custom Linux kernel module for a hardware device driver
Implemented a distributed system using Apache Kafka on Linux machines
Optimized performance of a database server running on Linux by tuning kernel parameters
Q13. What is microprocessor and explain register names?
A microprocessor is a computer processor that incorporates the functions of a central processing unit on a single integrated circuit.
Microprocessors are used in various electronic devices such as computers, smartphones, and gaming consoles.
Register names include program counter (PC), accumulator (ACC), general-purpose registers (GPR), and memory address register (MAR).
Registers are used to store data and instructions temporarily for processing.
The number of registers and thei...read more
Q14. What is difference between C and C++?
C++ is an extension of C with object-oriented programming features.
C++ supports object-oriented programming while C does not.
C++ has classes and templates while C does not.
C++ has better support for exception handling than C.
C++ has a standard library while C does not.
C++ allows function overloading while C does not.
Q15. What is difference between array and linked list?
Arrays are contiguous blocks of memory while linked lists are made up of nodes that point to the next node.
Arrays have fixed size while linked lists can grow dynamically.
Insertion and deletion are faster in linked lists than in arrays.
Arrays have better cache locality while linked lists have better memory utilization.
Arrays are accessed using indices while linked lists are accessed using pointers.
Examples of arrays include int[] and char[] while examples of linked lists inclu...read more
Q16. Explain whole process for Example.c file to Example.exe conversion
The process of converting Example.c file to Example.exe involves several steps.
Preprocessing: includes header file inclusion, macro expansion, and conditional compilation
Compilation: converts source code to object code
Linking: combines object code with libraries to create executable file
Debugging: identifying and fixing errors in code
Optimization: improving performance of executable file
Non-deterministic automata are theoretical models of computation where the next state is not uniquely determined by the current state and input.
Examples include non-deterministic finite automata (NFA) and non-deterministic pushdown automata (NPDA).
NFA can have multiple possible transitions for a given input symbol and state.
NPDA can have multiple possible transitions based on the current state, input symbol, and stack symbol.
Q18. What is data abstraction and explain with code?
Data abstraction is the process of hiding implementation details and showing only necessary information.
Abstraction is achieved through abstract classes and interfaces.
It helps in reducing complexity and increasing efficiency.
Example: abstract class Shape with abstract method draw() implemented by its subclasses like Circle and Rectangle.
Declaration refers to introducing a variable or function to the compiler, while definition provides the actual implementation.
Declaration tells the compiler about the type and name of a variable or function, without allocating memory or defining its implementation.
Definition allocates memory for a variable or function, and provides the actual implementation.
Example: int x; // Declaration, int x = 5; // Definition
Q20. I am working on multiple language so how you are comfortable to work on multiple language
I am comfortable working with multiple languages and have experience in doing so.
I have experience working with languages such as Java, Python, C++, and JavaScript.
I am able to quickly adapt to new languages and learn them efficiently.
I understand the importance of proper documentation and commenting in code to ensure readability for others.
I have worked on projects that required integration of multiple languages, such as a web application with a backend in Python and a front...read more
A page is a fixed-size block of memory managed by the operating system, while a frame is a fixed-size block of memory managed by the hardware.
Pages are managed by the operating system, while frames are managed by the hardware.
Pages are virtual memory blocks used by the operating system to manage memory, while frames are physical memory blocks used by the hardware.
Pages are typically smaller in size compared to frames, which are usually larger.
Example: In a system with 4KB pag...read more
Serial port transmits data one bit at a time, while parallel port transmits multiple bits simultaneously.
Serial port sends data sequentially, while parallel port sends data in parallel
Serial port uses fewer wires compared to parallel port
Examples of serial ports include RS-232, USB, and Ethernet ports, while examples of parallel ports include printer ports
Mutex is used for exclusive access to a resource, while semaphore is used for controlling access to a resource by multiple threads.
Mutex is binary and allows only one thread to access the resource at a time.
Semaphore can have a count greater than one, allowing multiple threads to access the resource simultaneously.
Mutex is used for protecting critical sections of code, while semaphore is used for synchronization between multiple threads.
Example: Mutex is like a key to a room ...read more
Types of polymorphism in OOP include compile-time polymorphism (method overloading) and runtime polymorphism (method overriding).
Compile-time polymorphism is achieved through method overloading, where multiple methods have the same name but different parameters.
Runtime polymorphism is achieved through method overriding, where a subclass provides a specific implementation of a method that is already defined in its superclass.
Polymorphism allows objects of different classes to ...read more
Time complexities for sorting algorithms vary from O(n^2) to O(n log n).
Bubble Sort - O(n^2)
Selection Sort - O(n^2)
Insertion Sort - O(n^2)
Merge Sort - O(n log n)
Quick Sort - O(n log n)
Heap Sort - O(n log n)
Q26. Write a SQL query to join two tables?
SQL query to join two tables
Use JOIN keyword to combine two tables based on a common column
Specify the columns to be selected using SELECT keyword
Use ON keyword to specify the common column between two tables
Q27. WAP for recursion and explain its working?
Recursion is a technique where a function calls itself to solve a problem. WAP for recursion is to write a program using recursion.
Recursion is used to solve problems that can be broken down into smaller sub-problems.
The base case is the condition where the function stops calling itself.
The recursive case is where the function calls itself with a smaller input.
Example: Factorial of a number can be calculated using recursion.
Example: Fibonacci series can be generated using rec...read more
The OSI (Open Systems Interconnection) model is a conceptual framework that standardizes the functions of a telecommunication or computing system into seven distinct layers.
Physical Layer: Deals with physical connections and transmission of raw data. Example: Ethernet cables.
Data Link Layer: Manages data transfer between devices on the same network. Example: MAC addresses.
Network Layer: Handles routing and forwarding of data packets. Example: IP addresses.
Transport Layer: Ens...read more
There are four types of access modifiers in Java: public, private, protected, and default.
Public: accessible from any other class.
Private: accessible only within the same class.
Protected: accessible within the same package and subclasses.
Default: accessible only within the same package.
Q30. What is TCP/IP,OSI model?
TCP/IP is a protocol used for communication between devices on the internet. OSI model is a conceptual framework for network communication.
TCP/IP is a suite of protocols that governs communication between devices on the internet.
OSI model is a conceptual framework that divides network communication into seven layers.
TCP/IP is based on a four-layer model, which includes the application, transport, internet, and network access layers.
The OSI model includes the physical, data li...read more
Q31. What is program counter?
Program counter is a register that stores the memory address of the next instruction to be executed by the processor.
Program counter is also known as instruction pointer.
It is a part of the processor's control unit.
The value of program counter is incremented after each instruction is executed.
If a program counter is corrupted, the processor may execute incorrect instructions.
Example: If the program counter is pointing to memory address 100, the next instruction to be executed...read more
The sizeof operator in C/C++ is used to determine the size of a data type or variable in bytes.
sizeof operator returns the size of a data type or variable in bytes.
It can be used with any data type, including primitive types, user-defined types, and arrays.
Example: sizeof(int) returns the size of an integer in bytes.
Paging in operating systems is a memory management scheme that allows the operating system to store and retrieve data from secondary storage when the physical memory (RAM) is full.
Paging divides the physical memory into fixed-size blocks called pages.
When a process is loaded into memory, it is divided into equal-sized blocks called pages as well.
The operating system keeps track of the pages in memory using a page table.
If a process requires more memory than is available in ph...read more
Java objects are stored in memory as references to memory locations where the actual object data is stored.
Java objects are stored in the heap memory.
Each object is allocated memory on the heap using the 'new' keyword.
Object references are stored on the stack.
Objects can be garbage collected when no longer referenced.
Q35. How to get unique elements from list
To get unique elements from a list, use set() function.
Convert the list to a set using set() function
Convert the set back to list using list() function
Example: list(set(['apple', 'banana', 'apple', 'orange'])) will return ['apple', 'banana', 'orange']
Q36. Explain SQL commands?
SQL commands are used to interact with databases and manipulate data.
SELECT: retrieve data from a database
INSERT: add new data to a database
UPDATE: modify existing data in a database
DELETE: remove data from a database
CREATE: create a new database or table
ALTER: modify the structure of a database or table
DROP: delete a database or table
JOIN: combine data from multiple tables
GROUP BY: group data based on a specific column
ORDER BY: sort data based on a specific column
A virtual function is a function in a base class that is declared using the keyword 'virtual' and can be overridden by a function in a derived class.
Virtual functions allow for dynamic polymorphism in C++
They are used in inheritance to achieve runtime polymorphism
Example: virtual void display() = 0; // pure virtual function
Q38. How memory allocated to object
Memory is allocated to objects dynamically during runtime based on their size and type.
Memory allocation is done using the 'new' keyword in languages like Java and C++.
In languages like Python, memory allocation is handled automatically by the interpreter.
Memory allocation can also be done using functions like malloc() and calloc() in C.
Memory is released using the 'delete' keyword in languages like Java and C++.
Memory management is important to prevent memory leaks and optim...read more
Q39. WAP to reverse string?
A program to reverse a given string.
Create an empty string to store the reversed string.
Iterate through the original string from end to start.
Append each character to the empty string.
Return the reversed string.
Q40. Explain pointers and heap ?
Pointers are variables that store memory addresses. Heap is a region of memory used for dynamic memory allocation.
Pointers are used to access memory directly
Heap is used for dynamic memory allocation
Pointers can be used to create data structures like linked lists
Heap memory must be manually managed to avoid memory leaks
Data abstraction is the process of hiding the implementation details of data and only showing the necessary information to the user.
It allows users to interact with data without needing to know the underlying complexities.
Helps in reducing complexity and improving code readability.
Examples include classes in object-oriented programming where private data members are hidden from outside access.
Mutual exclusion is a concept in computer science where only one process can access a resource at a time.
Prevents multiple processes from accessing a shared resource simultaneously
Achieved through the use of locks, semaphores, or other synchronization mechanisms
Ensures data consistency and prevents race conditions
Example: Using a mutex to protect a critical section of code in a multi-threaded application
Q43. What is join and how many types.
Join is a SQL operation that combines rows from two or more tables based on a related column between them.
Join is used to retrieve data from multiple tables in a single query.
There are four types of joins: Inner Join, Left Join, Right Join, and Full Outer Join.
Inner Join returns only the matching rows from both tables.
Left Join returns all the rows from the left table and matching rows from the right table.
Right Join returns all the rows from the right table and matching rows...read more
Q44. find non repeating character in an array
Find the first non-repeating character in an array.
Use a hash table to store the frequency of each character.
Iterate through the array and check the frequency of each character.
Return the first character with a frequency of 1.
Q45. Comparable vs comparator
Comparable is an interface used for natural ordering while Comparator is an interface used for custom ordering.
Comparable is implemented by the class whose objects need to be sorted
Comparator is implemented by a separate class to define custom sorting logic
Comparable uses compareTo() method to compare objects
Comparator uses compare() method to compare objects
Example: String class implements Comparable interface for natural ordering
Example: Employee class implements Comparator...read more
Q46. Hash table implementation
Hash table is a data structure that maps keys to values using a hash function.
Hash function maps keys to indices in an array
Collisions can occur, which can be resolved using techniques like chaining or open addressing
Lookup, insertion, and deletion operations have an average time complexity of O(1)
Q47. what is destructing in JS
Destructuring is a way to extract values from objects and arrays into distinct variables.
Destructuring can be used with arrays and objects
It allows you to extract values from nested objects and arrays
You can also set default values for variables that may not exist in the object or array
Example: const {name, age} = {name: 'John', age: 30};
Example: const [first, second] = ['one', 'two'];
Q48. Explain about oops
Object-oriented programming paradigm that focuses on objects and classes for code organization and reusability.
Encapsulation: Bundling data and methods that operate on the data into a single unit (object)
Inheritance: Ability for a class to inherit properties and behavior from another class
Polymorphism: Ability for objects of different classes to respond to the same method call in different ways
Q49. Realtime examples
Realtime examples of software engineering concepts
Implementing a chat application with real-time messaging using WebSockets
Developing a stock trading platform with live updates on stock prices
Creating a multiplayer online game with real-time player interactions
Top HR Questions asked in Acro Technologies
Interview Process at Acro Technologies
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month