what would be the output of the following prog? Justify
your answer?
main()
{
unsigned char ch;
unsigned char i;
ch = -255;
printf("%d",ch);
i = -1;
printf("%d",i);

}



what would be the output of the following prog? Justify your answer? main() { unsigned char ch;..

Answer / bittu

1255

this is because -255 (00000001) when considered unsigned
looks like 1(00000001) in binary and -1(11111111) when
considered unsigned looks like 255(11111111) in binary
(11111111).

refer to this
http://www.allaboutcircuits.com/vol_4/chpt_2/3.html

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More C Interview Questions

How would you sort a linked list?

1 Answers  


what is the advantage of using SEMAPHORES to ORDINARY VARIABLES???

2 Answers   NSN,


Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))… For example, using 99, we get the sequence 99, 99 = 81, 81 = 8. Input Format: A single integer N Output Format: A single integer which is the number of steps after which a single digit number occurs in the sequence. Sample Test Cases: Input #00: 99 Output #00: 2 Explanation: Step - 1 : 9 * 9 = 81 Step - 2 : 8 * 1 = 8 There are 2 steps to get to this single digit number. Input #01: 1137638147

2 Answers  


Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms

5 Answers   Convex Digital,


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

1 Answers  


Predict the output or error(s) for the following: 25. main() { printf("%p",main); }

3 Answers   Google, ME,


What is a dynamic array in c?

1 Answers  


What is the purpose of main() function?

1 Answers  


What is the difference between ++a and a++?

1 Answers  


A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor

1 Answers  


Explain what does the function toupper() do?

1 Answers  


Can we initialize extern variable in c?

1 Answers  


Categories