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   To Refer this Site to Your Friends   Click 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 the difference between big endian form and little 
endian form? write a code to convert big endian form to 
little endian and vice versa..
 Question Submitted By :: Lakshmi
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..
Answer
# 1
Little endian has least significant digit at far left.
Big endian has most significant digit at far left.
 
Is This Answer Correct ?    9 Yes 0 No
Peter
 
  Re: What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..
Answer
# 2
the endianness of a bus determines whether the MSB is put
into the lowest address
(big-endian) or in the highest address (little-endian).
 
Is This Answer Correct ?    2 Yes 1 No
Amit
 
 
 
  Re: What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..
Answer
# 3
Little Endian ->LSB at lower address
Big Endian -> MSB at lower address
e.g:
    if the value is 0x0A0B0C0D then
in case of LE storage will be
Address 1000 0D
Address 1001 0C
Address 1002 0B
Address 1003 0A

in case of BE storage will be
Address 1000 0A
Address 1001 0B
Address 1002 0C
Address 1003 0D

Marco to convert(this will convert from LE to BE or BE to 
LE--> one for all :) )

#define CON(NUM) (NUM&0x000000FF)<<24|(NUM&0x0000FF00)<<8 
|NUM&0x00FF0000)>>8 |(NUM&0xFF000000)>>24
 
Is This Answer Correct ?    4 Yes 0 No
Raj
 
  Re: What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..
Answer
# 4
Small correction in above macro.
'(' was missing in second line.

#define CON(NUM) (NUM&0x000000FF)<<24|(NUM&0x0000FF00)<<8 
|(NUM&0x00FF0000)>>8 |(NUM&0xFF000000)>>24
 
Is This Answer Correct ?    0 Yes 0 No
Vish
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
18)struct base {int a,b; base(); int virtual function1(); } struct derv1:base{ int b,c,d; derv1() int virtual function1(); } struct derv2 : base {int a,e; } base::base() { a=2;b=3; } derv1::derv1(){ b=5; c=10;d=11;} base::function1() {return(100); } derv1::function1() { return(200); } main() base ba; derv1 d1,d2; printf("%d %d",d1.a,d1.b) o/p is a)a=2;b=3; b)a=3; b=2; c)a=5; b=10; d)none 19) for the above program answer the following q's main() base da; derv1 d1; derv2 d2; printf("%d %d %d",da.function1(),d1.function1(),d2.function1 ()); o/p is a)100,200,200; b)200,100,200; c)200,200,100; d)none 20)struct { int x; int y; }abc; you can not access x by the following 1)abc-->x; 2)abc[0]-->x; abc.x; (abc)-->x; a)1,2,3 b)2&3 c)1&2 d)1,3,4  1
Which of the following are valid "include" formats? A)#include and #include[file.h] B)#include (file.h) and #include C)#include [file.h] and #include "file.h" D)#include <file.h> and #include "file.h" Accenture14
Determine the code below, tell me exactly how many times is the operation sum++ performed ? for ( i = 0; i < 100; i++ ) for ( j = 100; j > 100 - i; j--) sum++; ITCO3
Tell us the difference between these two : #include"stdio.h" #include<stdio.h> define in detial.  4
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? } NDS9
6)swap(int x,y) { int temp; temp=x; x=y; y=temp; } main() { int x=2;y=3; swap(x,y); } after calling swap ,what are yhe values x&y?  2
Who is invented by c? Infosys14
Is the following code legal? struct a { int x; struct a b; }  3
what is the difference between arrays and linked list Tech-Mahindra15
in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?  6
Write a routine that prints out a 2-D array in spiral order! Lucent1
i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }  2
2)#include<iostream.h> main() { printf("Hello World"); } the program prints Hello World without changing main() the o/p should be intialisation Hello World Desruct the changes should be a)iostream operator<<(iostream os, char*s) os<<'intialisation'<<(Hello World)<<Destruct b) c) d)none of the above Siemens4
main() { int i=400,j=300; printf("%d..%d"); } ME8
void main() {int a[5],i,b=16; for(i=0;i<5;i++) a[i]=2*i; f(a,5,b); for(i=0;i<5;i++) printf("\n %d",a[i]); printf("\n %d",b); } f(int *x,int n,int y) { int i; for(i=0;i<n;i++) *(x+i)+=2; y=y+2; }wat r the errors in the prg.and improvise the prg to get o/p.?  2
a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21 TCS4
what is the difference between #include<> and #include”…”?  1
pgm in c to reverse string by word using array(god is love becomes love is god) (no additional array can used,space is only delimiter between words ) Persistent1
size maximum allocated by calloc() DELL1
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 } Wipro4
 
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