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                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions
 C++ Code interview questions  C++ Code Interview Questions
 VC++ Code interview questions  VC++ Code Interview Questions
 Java Code interview questions  Java Code Interview Questions
 Dot Net Code interview questions  Dot Net Code Interview Questions
 Visual Basic Code interview questions  Visual Basic Code Interview Questions
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions
Question
main()

      {

		int i = 258;

      	int *iPtr = &i;

		printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );

      }
 Question Submitted By :: Susie
I also faced this Question!!     Rank Answer Posted By  
 
  Re: main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }
Answer
# 1
Answer : 

		2 1 

      Explanation:

The integer value 257 can be represented in binary as,
00000001 00000001. Remember that the INTEL machines are
‘small-endian’ machines. Small-endian means that the lower
order bytes are stored in the higher memory addresses and
the higher order bytes are stored in lower addresses. The
integer value 258 is stored in memory as: 00000001 00000010.
 
Is This Answer Correct ?    0 Yes 0 No
Susie
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }  1
Sorting entire link list using selection sort and insertion sort and calculating their time complexity NetApp1
main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above HCL1
void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, j, k); }  1
main() { extern out; printf("%d", out); } int out=100;  1
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }  1
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }  1
main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16 HCL1
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”) HCL1
main() { char *p = “ayqm”; printf(“%c”,++*(p++)); } TCS2
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }  1
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }  1
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }  1
write the function. if all the character in string B appear in string A, return true, otherwise return false. Google10
What are the files which are automatically opened when a C file is executed?  1
main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error HCL1
Print an integer using only putchar. Try doing it without using extra storage.  1
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it. Wipro2
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }  1
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }  1
 
For more C Code 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