TCS Company Programming Technical

Parul takes as input two numbers: a and b. a and b can take integer values
between 0 and 255. She stores a, b and c as 1-byte data type. She writes the
following code statement to process a and b and put the result in c.
c = a + 2*b
To her surprise her program gives the right output with some input values of a and b,
while gives an erroneous answer for others. For which of the following inputs will it
give a wrong answer?

Read Solution (Total 2)

TCS Other Question

on door A-it leads to freedom
on door B-it leads to ghost house
on door C-door B leads to ghost house
the statement written on one of doors is wrong
identify which door leads to freedom
The perimeter of an equilateral triangle is equal to a regular hexagon. Find out the ratio of their areas?