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   SiteMap shows list of All Categories in this site.
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
 
write a fuction for accepting and replacing lowercase letter to'Z' with out using inline function. Temenos4
What is Heap?  3
Can we write a program without main() function?  9
What is function pointer and where we will use it NetApp1
write a program to find the sum of the array elements in c language?  8
What will be result of the following program? void myalloc(char *x, int n) { x= (char *)malloc(n*sizeof(char)); memset(x,\0,n*sizeof(char)); } main() { char *g="String"; myalloc(g,20); strcpy(g,"Oldstring"); printf("The string is %s",g); } a) The string is : String b) Run time error/Core dump c) The string is : Oldstring d) Syntax error during compilation e) None of these IBM3
what is the difference between structural,object based,object orientd programming languages? PanTerra1
write a program for odd numbers?  6
Can you think of a way when a program crashed before reaching main? If yes how?  2
which header file contains main() function in c? TCS3
program to find the second largest word in a paragraph amongst all words that repeat more thn twice iGate3
can you explain in brief what is "r+" mode in a file... i know that it si used to read and modify rhe existing content.... but explalanation about the file pointer in "r+" mode i wann to know??????????? Cognizent1
write a own function for strstr LG-Soft1
What is a far pointer?What is the utility?  2
What should be keep precautions while using the recursion method?  1
What's wrong with "char *p; *p = malloc(10);"?  5
How to implement variable argument functions ? HP1
how to find the binary of a number? Infosys5
Write a program in c to input a 5 digit number and print it in words.  1
how to find out the inorder successor of a node in a tree?? TCS2
 
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