GATEverse
← GATE CSE 1995

Q18

NATMarks unknown

The following is an incomplete Pascal function to convert a given decimal integer (in the range −8-8 to +7+7) into a binary integer in 22’s complement representation. Determine the expressions A,B,CA, B, C that complete program. function TWOSCOMP (N:integer):integer; var REM, EXPONENT:integer; BINARY :integer; begin if(N>=-8) and (N<=+7) then begin if N<0 then N:=A; BINARY:=0; EXPONENT:=1; while N<>0 do begin REM:=N mod 2; BINARY:=BINARY + B*EXPONENT; EXPONENT:=EXPONENT*10; N:=C end TWOSCOMP:=BINARY end end;

Sign in to save attempts.

Loading…