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
CopyBits(x,p,n,y)
copy n LSBs from y to x starting LSB at 'p'th position.
 Question Submitted By :: Superhuman
I also faced this Question!!     Rank Answer Posted By  
 
  Re: CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.
Answer
# 1
t=0;
for(i=n; i>0; i--)
{
  t|=(1<<p);
  p++;
}
t=t&y;
x=x&t;
 
Is This Answer Correct ?    0 Yes 0 No
Mohammed Sardar
 
  Re: CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.
Answer
# 2
Sorry above answer ; I did a mistake
t=0;
for(i=n; i>0; i--)
{
  t|=(1<<p);
  p++;
}
x=x&~t
t=t&y;
x=x|t;
 
Is This Answer Correct ?    0 Yes 0 No
Mohammed Sardar
 
 
 
  Re: CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.
Answer
# 3
t =((~(~0<<n))<<p)
x = x & ~t;
y = y & t;
x=x|y;
 
Is This Answer Correct ?    0 Yes 0 No
Yash
 
  Re: CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.
Answer
# 4
It should be p--, not p++. for example y = 217 (11011001) 
and you want to extract the least 4 SB then n = 4 and p = 3 
(remember the number start from 0 to 7 in memory). After 
executing this you will get x = 9 i.e 1001.

t=0;
for(i=n; i>0; i--)
{
      t |= (1<<p);
      p--;
}
x=x&~t;
t=t&y;
x=x|t;
 
Is This Answer Correct ?    0 Yes 0 No
Rakesh
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
We can draw a box in cprogram by using only one printf();& without using graphic.h header file? NIIT3
How to use c/c++ code in JAVA Satyam7
if a person is buying coconuts of Rs10,and then sell that coconuts of Rs9,with the loss of one rupee.After that the person became a millaniore.how? Wipro5
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?  3
for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????  6
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } ADITI1
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } CitiGroup7
5. distance conversion: Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer  1
Study the Following Points: a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static 1. Which of the Following Statements are true w.r.t Bit- Fields A)a,b&c B)Only a & b C)Only c D)All Accenture2
While(1) { } when this loop get terminate is it a infinite loop?  4
Can u return two values using return keyword? If yes, how? If no, why?  7
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.. Aricent4
What are data breakpoints? Adobe1
how to generate the length of a string without using len funtion?  3
Reverse a string word by word??  6
Function to find the given number is a power of 2 or not? Motorola12
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; } Honeywell2
what is the advantage of function pointer TCS9
main() { int i,j,A; for(A=-1;A<=1;A++) prinf("%d\t",!!A); }  5
How can I invoke another program from within a C program?  6
 
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