Amantya Technologies
Beratung Consultants Interview Questions and Answers
Q1. Write a code of binary search and explain it
Binary search is a search algorithm that finds the position of a target value within a sorted array.
Divide the array into two halves
Compare the target value with the middle element
If the target value matches the middle element, return its position
If the target value is less than the middle element, search the left half of the array
If the target value is greater than the middle element, search the right half of the array
Repeat until the target value is found or the search spac...read more
Q2. Reverse a string by making groups of given 'm' characters
Reverse a string by grouping 'm' characters together
Iterate through the string in groups of 'm' characters
Reverse each group of 'm' characters
Concatenate the reversed groups to get the final reversed string
Q3. Tell me something about Data Sturcture
Data structure is a way of organizing and storing data in a computer so that it can be accessed and used efficiently.
Data structures can be linear (arrays, linked lists) or non-linear (trees, graphs)
Common operations on data structures include insertion, deletion, and searching
Examples of data structures include stacks, queues, hash tables, and binary trees
Q4. Write an API call in C
API call in C
Include the necessary header files
Create a URL string with the required parameters
Use the curl library to make the API call
Handle the response data appropriately
Q5. Difference between TCP and UDP
TCP is a connection-oriented protocol while UDP is connectionless.
TCP provides reliable, ordered, and error-checked delivery of data while UDP does not guarantee any of these.
TCP is slower but more reliable while UDP is faster but less reliable.
TCP is used for applications that require high reliability and accuracy such as email, file transfer, and web browsing while UDP is used for applications that require speed and efficiency such as online gaming and video streaming.
Q6. Nibble swap program in C
A nibble swap program in C
Nibble swap means swapping the 4-bit halves of a byte
Use bitwise operators to perform the swap
Example: unsigned char x = 0xAB; x = ((x & 0x0F) << 4) | ((x & 0xF0) >> 4);
Q7. Reverse Linked List in C
Reverse a linked list in C language.
Create three pointers: current, previous, and next.
Traverse the linked list and change the direction of the pointers.
Return the new head of the reversed linked list.
More about working at Amantya Technologies
Interview Process at Beratung Consultants
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month