May
2005, Issue 178
Test Your EQ
Each
month, Test Your EQ presents some basic engineering
problems for you to test your Engineering Quotient.
What's your EQ?
|
Problem
1—What
does the following C code compute? Assume that uint16
is an unsigned 16-bit integer type on this platform. Analyze
its operation in mathematical terms.
#define Precision ( 16 >> 1 )
uint16 Function (uint16 Number)
{
uint16 Result;
uint16 Mask;
uint16 Mask2;
uint16 Test;
uint16 Power;
Result = 0;
Result2 = 0;
Mask = 1 << (Precision - 1 );
Mask2 = 1L << ( ( Precision - 1 ) << 1 );
for (Power = Precision; Power > 0; --Power) {
Test = Result2 + Mask2 + ((uint16)Result << Power);
if (Test <= Number) {
Result2 = Test;
Result |= Mask;
}
Mask >>= 1;
Mask2 >>= 2;
}
return Result;
}
Answer
Problem
2Similarly, what does the following C code compute?
Assume that uint32
is an unsigned 32-bit integer type on this platform. Again,
analyze its operation in mathematical terms.
uint32 func (uint32 n)
{
uint32 result = 0, bit, trial;
bit = (n >= 0x10000) ? 1<<30 : 1<<14;
do {
trial = result + bit;
if (n >= trial) {
n -= trial;
result = trial + bit;
}
result >>= 1;
bit >>= 2;
} while (bit);
return result;
}
Answer
Problem 3What is the signal format used in a digital
telephony T1 type of circuit?
Answer
Problem
4What is the analog bandwidth of a T1 signal?
Answer
Problem
5An electric solenoid is being driven in a conventional
manner, as shown below, but the solenoid is being used in
a mechanical brake and the brake is releasing too slowly
when the control signal is turned off. What can be done
about this?

Answer
Problem
6Sometimes a solenoid can function well with a
holding current that’s less than (say, half of) its full
current rating. How can you take advantage of this?
Answer
Problem
7It’s common knowledge that you can divide
a number by a power of two by doing a simple right shift
of the number. What do the following relationships tell
you?

Answer
Problem
8How can you evaluate a general Nth-order
polynomial using just N multiplication and N
addition operations?
Answer
Previous Month
|