Affluence Infosystems Interview Questions


1)Write a function that takes an integer input value and returns the immediate lowest number
    using the same digits?

 Ex 1:- Input   : 321
            Output: 312 

 Ex 2:- Input    : 65438
            Output: 65384


2)Swap two bits each in a binary number?

Example: 01 to 10
Input : 109  --> 00 01 10 11 01
            158  -->00 10 01 11 10

3)Write a C program to implement the LS command without using a system call?


4)Write a Program for the given prefix expression?

Ex 1:- * - ABC  ---> (A-B)*C

Ex 2:- *A-BC   ---> A *(B-C)


5)Extract and count the longest sequence of ones in a binary (Print start bit position and End Position)?

Ex:- 7150 - (0000 0000 0000 0000 0001 1011 1110 1110 )

Output: Start bit position: 5th & End bit position: 9th 


6)Write a C  Program for the below pattern take row size at run time?

Ex: If the user enters the row size as 10, Print numbers as below.



7)Write a C Program to search a word and replace it with the specified word?

8)Write a C Program to remove all the characters in the second string which are present
    in the first-string?

9)copy n bits from positions of number 1 to position p of numbers?

cpoy_bits(unsigned int num1,unsigned int num2,int s,int p,int n);

10)Write a program to remove all comments from a c program?

11)Write a single line program that converts little-endian to big-endian (32-bit format)?

12)Write a function which takes 3 digit input value and returns the next highest number
      using the same digits?

Ex1: Input : 123 output : 132

Ex2:Input : 921    output:921

12)Write a program to reverse the words in line from a given input line?

Eg:   Input: Golconda fort located in Hyderabad 
      Output: Hyderabad in located fort Golconda

13)Write a function to reverse the single linked list?

14)What is Makefile? Write a Makefile. How to compile it?

15)A troop is surrounded by the enemy, they need help and there is only one
    horse to call reinforcement. To decide who will ride the horse and go to
    fetch reinforcements they play a game? solve this problem using a circular 
    linked list, implement the following function.

struct Node*whoRidesHorse(struct  Node*circular List Head,unsigned int count)

{
*
shall return the last remained soldier from the list 
*
}

16)Write a function that takes integer input and returns the possible highest number using 
     the same digits?

   Input: 9848565643
   Output: 9886655443

17)Write Individual C Programs,program 1 prints first 500 odd numbers,program 2 prints first 
       500 even numbers,synchronize the both programs and print out as 1,2,3,4,5,6,....,etc.

Hint: Using POSIX Processes

18)Swap two nibbles (4 bits) in a Byte from the given number?

Example:

Input   :Hex representation value of 43981 is 0XABCD
Output: (47836) is 0XBADC

18)Write a  C  Program for the below pattern take row size at runtime?

     1    16    15  14     13
     2    17    24  23     12
     3    18    25  22     11
     4    19    20  21     10
     5     6      7    8      9

19)Extract the longest sequence of the "01" pattern in a given number (Print starting 
      bit position and last position)

Example : 
Input :   7062 - 0000 0000 0000 0000 0001 1011 1010 1010
Output: Starting bit position 1st and last position 6th 


20)Write a Program for prefix expression to input?

Example 1: *-ABC becomes (A-B)*C
Example 2 : *A-BC becomes A*(B-C)


21)What is the difference between Structure and Union?

22)What is Const Type Qualifier?

23)What is Dangling Pointer and How to avoid it?

24)What is a Segmentation fault?

25)Explain structure padding?

26)Explain the Memory Layout of the C Program?

27)What is Dynamic Memory Allocation?

28)What is the use of the Volatile Keyword?

29)What is meant by Storage Classes?