Wednesday, July 08, 2009

Seagate Interview (+Delphi)

Talked a lot of non sense again... >_<|||

Some questions:
1. HW architecture of past projects
2. Thread scheduling, Preemptive, Cooperative OS
3. Task/Process synchronization
4. Atomic Operation (link)

Delphi:
- use #define to return number of seconds for a year, ignore leap year
- define a MIN macro, return minimum value of 2 arguments
- What's static used for
- How to infinite loop
- volatile and its 3 different usage
http://publications.gbdirect.co.uk/c_book/chapter8/const_and_volatile.html
http://ou800doc.caldera.com/en/SDK_cprog/_When_to_Use_volatile.html
http://www.netrino.com/node/80 (Y)

1. Memory-mapped peripheral registers

2. Global variables modified by an interrupt service routine

3. Global variables accessed by multiple tasks within a multi-threaded application


- what is #error used for?

During the preprocessing phase, you can report errors by using the #error preprocessor directive.

- const
const int a;
int const a;
const int *a; // a is pointer to a constant int
int * const a; // a is a constant pointer to a int variable
int * const a const;

- write 2 code segments that set and clear bit 3 of a respectively
unsigned int a;
a |= 0x00000004;
a &= 0xFFFFFFFB;

Delphi and Seagate use similar questions below (quite standard for firmware positions I guess)
- ANSI compiler, write code to assign value to specific memory location

int *p = (int *)0x6638;
*p = 0xaa55;

- Spot errors in ISR
__interrupt double doISR(double a) // ISR doesn't take input
{
double area = some calculation(a);
printf("area is %f", area); // NO printf in ISR
return area; // NO return in ISR
}

- Explain the output
unsigned int a = 6;
int b = -20

(a+b > 6) ? puts("> 6) : puts("<= 6");

No comments: