Monday, December 1, 2008

Technical questions with answer in C programming language

1)
main()
{
 int i =0;j=0;
 if(i && j++)
   printf("%d..%d",i++,j);
printf("%d..%d,i,j);
}

Answer:-
0..0
 
Explanation:
The value of i is 0. Since this information is enough to determine the truth value of the boolean expression. So the statement following the if statement is not executed.  The values of i and j remain unchanged and get printed.
      
2)
main()
{
 int i;
 i = abc();
 printf("%d",i);
}
abc()
{
 _AX = 1000;
}

Answer:-
1000

Explanation:
Normally the return value from the function is through the information from the accumulator. Here _AH is the pseudo global variable denoting the accumulator. Hence, the value of the accumulator is set 1000 so the function returns value 1000. 

3)
int i;
     main()
{
int t;
for ( t=4;scanf("%d",&i)-t;printf("%d\n",i))
             printf("%d--",t--);
             }
// If the inputs are 0,1,2,3 find the o/p


Answer:
  4--0
3--1
2--2

Explanation:
Let us assume some x= scanf("%d",&i)-t the values during execution 
           will be,
          t        i       x
          4       0      -4
          3       1      -2
          2       2       0
          
5)
main(){
  int a= 0;int b = 20;char x =1;char y =10;
  if(a,b,x,y)
        printf("hello");
 }

Answer:
hello 

Explanation:
The comma operator has associativity from left to right. Only the rightmost value is returned and the other values are evaluated and ignored. Thus the value of last variable y is returned to check in if. Since it is a non zero value if becomes true so, "hello" will be printed.

5)
 main()
 {
 unsigned int i;
 for(i=1;i>-2;i--)
         printf("c aptitude");
}

Explanation:
i is an unsigned integer. It is compared with a signed value. Since the both types doesn't match, signed is promoted to unsigned value. The unsigned equivalent of -2 is a huge value so condition becomes false and control comes out of the loop. 

ALL PLACEMENT TECHNICAL INTERVIEW QUESTION  BANCK   

1Technical /logical interview questions and solution in C language |2Technical / logical interview questions in C language |3C programming Language Technical Questions And Answers |4C Language Technical Questions And Answers |5C Language Technical Interview Questions And solution |6C Language Technical Interview Questions And Answers |7C Language Interview Questions And Solution |8online Placement Question of c programming languge |9online placement c programming question|10online test of c programming languge|11placement c programming quiz with solution |12c programming quiz with solution |13C programming languge quiz with solution |14C quiz with solution |15C languge quiz with solution  |16C programming quiz with solution |17questions with answer in C programming language|18Technical questions with solution in C programming language  |19Technical questions with answer in C programming language |20placement Question and answer in Simple C Language |21Simple C Language placement Question and answer22Simple C programming Question and answer |23Simple C programming Question and answer |24Simple C Language Question and answer |25c progrmming Interview question with solution  |26Technical placement question with solution in c progrmming |27placement c progrmming Question with Answer  |28c progrmming placement question with solution  |29 placement c progrmming languge question with Answer |30placement c progrmming languge question with solution  |31c progrmming languge placement question with solution  |32c languge placement question with solution |33placement c programming languge problem with solution  |34c programming languge placement problem with solution  |35c language placement problem with solution  |36Placement c languge problem with solution  |37c language problem with answer  |38c language problem with solution  |

No comments:

Post a Comment

Thanks to given comments.......

My Blog List