ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
what is output of the following statetment?Printf(“%x”,
-1<<4); ?
 Question Submitted By :: A. Sujatha
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is output of the following statetment?Printf(“%x”, -1<<4); ?
Answer
# 1
here the equivalent representation for -1 in memory is it's
two's compliment notation..... so alll the 16 bits will be
HIGH (1).... so four time we are moving the bits left
side.... so after that it will result as 65520.... the
equivalent HEX value for 65520 will get printed.........



thank u
 
Is This Answer Correct ?    0 Yes 0 No
Vignesh1988i
 
  Re: what is output of the following statetment?Printf(“%x”, -1<<4); ?
Answer
# 2
Answer fff0.........As -1 is internally represented as as
all 1's.When left shifted four times the least significant 4
bits are filled with 0's.The %x format specifier specifies
that the integer value be printed as a hexadecimal value.
 
Is This Answer Correct ?    2 Yes 0 No
Sasmita Lenka
 
 
 
  Re: what is output of the following statetment?Printf(“%x”, -1<<4); ?
Answer
# 3
-1 is stored as '1' 32 times [i.e. ffffffff], doing a left
shift 4 times results in '1' 28 times followed by 4 zeros.
[i.e. in hexadecimal ffffffff0].

Therefore the output for the above printf is fffffff0.

Thanks,
Ranjith
 
Is This Answer Correct ?    1 Yes 0 No
Ranjith
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen) NetApp1
DIFFERNCE BETWEEN THE C++ AND C LANGUAGE? Wipro1
Design a program using an array that searches a number if it is found on the list of the given input numbers and locate its exact location in the list.  3
how to find out the biggest element (or any other operation) in an array which is dynamic. User need not to mention the array size while executing.  2
fun(int x) { if(x > 0) fun(x/2); printf("%d", x); } above function is called as: fun(10); what will it print? } NDS13
What's a "sequence point"?  2
char ch=10;printf("%d",ch);what is the output Accenture11
how to create c progarm without void main()?  1
given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the array which of the following is incorrect? a.*(a+5) b.a[5] c.pa[5] d.*(*pa + 5) TCS5
how to generate the length of a string without using len funtion?  3
pick out the odd one out of the following a.malloc() b.calloc() c.free() d.realloc() TCS1
what is dangling pointer? LG-Soft1
What kind of sorting is this? SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort Accenture3
how can we use static and extern?and where can we use this? Excel3
what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);} TCS8
size maximum allocated by calloc() DELL1
Consider a language that does not have arrays but does have stacks as a data type.and PUSH POP..are all defined .Show how a one dimensional array can be implemented by using two stacks. Google3
Write code for atoi(x) where x is hexadecimal string. Adobe2
Hi, main() { } Is a user defined function or Built in Functionn Honeywell9
what is the difference between #include<stdio.h> and #include "stdio.h" ?  2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com