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
Two's compliment of -5
 Question Submitted By :: Superhuman
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Two's compliment of -5
Answer
# 1
first write the given number in it's binary format.
am considering only 8 bit at a time , 
5- 0000 0101
step 1: convert this binary format to one's compliment (ie)
change 0 to 1 and 1 to 0.
1111 1010

step 2: add 1 to the above binary format.

1111 1010
        1
-----------
1111 1011

so this binary format will get stored in memory and the sign
bit will be set to 1.

always the negative number will be stored only in 2's
compliment..........


thank u
 
Is This Answer Correct ?    7 Yes 0 No
Vignesh1988i
 
  Re: Two's compliment of -5
Answer
# 2
Or in other words
~5+1
 
Is This Answer Correct ?    2 Yes 0 No
Ataraxic
 
 
 
  Re: Two's compliment of -5
Answer
# 3
ans: +5

-5 will be stored as 2's complement of 5
2's complement of -5, is thus 2 times 2's complement of 5.
so the ans is 5 itself.
 
Is This Answer Correct ?    2 Yes 0 No
Ramprasad G
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
write a c program to check weather a particluar bit is set or not? IBM4
what is the benefit of c30  1
How does C++ help with the tradeoff of safety vs. usability?  1
if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element. Zycus-Infotech9
how can i get this by using for loop? * ** * **** * ****** Excel3
what is the advantage of function pointer TCS9
how memory store byte Huawei3
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+.... Ignou2
#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output? Ramco5
related to rdbms query .  1
differentiate between const char *a; char *const a; and char const *a; HCL1
what is calloc and malloc?  1
How can I make a program in c to print 'Hello' without using semicolon in the code? C-DAC5
write a C program to print the program itself ?! TCS11
Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa.  1
without using arithmatic operator convert an intger variable x into x+1  1
study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above Accenture13
how to do in place reversal of a linked list(singly or doubly)?  2
What is macro? IBM4
Software Interview Questions CAT1
 
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