1. Explain Scope of static variables?

Static variables can only be accesed in the files were they are declared.

Static variable within the scope of a function store it's values in consecutive calls of that function.

Static functions can only be caled within the file they are defined.

2. Explain What is interrupt latency?

Interrupt latency refers to the amount of time between when an interrupt is triggered and when the interrupt is seen by software.

3. How to define a structure with bit field members?

You can define structure bit field members with Dot operators.

EXAMPLE:

#include <stdio.h>
int main()
{

Struct bit_field
{
Int x.4; // it allocates only 4 bits to x
Char C.6; // it allocates only 6 bits to C;
};

return 0;
}

4. Explain What is the difference between embedded systems and the system in which RTOS is running?

Embedded system can include RTOS and cannot include also. it depends on the requirement. if the system needs to serve only event sequencially, there is no need of RTOS. If the system demands the parallel execution of events then we need RTOS.

5. How is function itoa() written in C?

#include<stdlib.h>
#include<stdio.h>
int main()
{
int n = 6789;
char p[20];
itoa(n,s,10);
printf("n=%d,s=%s",n,s);
return 0;
}

6. Explain What is forward reference w.r.t. pointers in c?

Pointer use's to reference to value a into int a=10 to memory add this value and 10 is add p value added this data in memory location for p............for reference key is a

7. Explain What are the different storage classes in C?

Four types of storage classes are there in c.
1.Auto
2.Register
3.Static
4.Extern or Global

8. Explain Can we have constant volatile variable?

Const and volatile keywords should not be used together because both are opposite in nature.
A variable is declared as "const" means it's value is not able to be changed but if it is declared as "Volatile" then it is not under control.

9. Explain Can structures be passed to the functions by value?

Yes structures can be passed to functions by value. Though passing by value has two disadvantages :

1) The charges by the calling function are not reflected
2) Its slower than the pass by reference function call.

10. Explain What will this return malloc(sizeof(-10))?

It will return a 4 byte address value.
Because -10 is a signed integer(varies from compiler to compiler).

Download Interview PDF

11. Explain What are the 5 different types of inheritance relationship?

5 level types are as under:
single: B derived from A
multilevel:C derived from B and B derived from A
multiple:C derived from A and B
Hierarchical:B derived from A and C derived from A
hybrid:combination of above types

12. Explain What are different qualifiers in C?

1) Volatile:
A variable should be declared volatile whenever its value could change unexpectedly. In practice, only three types of variables could change:
► Memory-mapped peripheral registers
► Global variables modified by an interrupt service routine
► Global variables within a multi-threaded application

2) Constant:
The addition of a 'const' qualifier indicates that the (relevant part of the) program may not modify the
variable.

13. Explain What are the different qualifiers in C?

1) Volatile:
A variable should be declared volatile whenever its value could change unexpectedly. In practice, only three types of variables could change:
► Memory-mapped peripheral registers
► Global variables modified by an interrupt service routine
► Global variables within a multi-threaded application

2) Constant:
The addition of a 'const' qualifier indicates that the (relevant part of the) program may not modify the
variable.

14. Explain what is interrupt latency? How can we reduce it?

interrupt latency is the time required to return from the interrupt service routine after tackling a particular interrupt. We can reduce it by writing smaller ISR routines.

15. Explain Why cannot arrays be passed by values to functions?

Because in C when you say the name of the array it means the address of the first element.
example :
int a[];
func (a);
int func(int a[]);

In this when you call the function by passing the argument a actually &a[0](address of first element) gets passed. Hence it is impossible to pass by value in C.

16. What are the advantages and disadvantages of using macro and inline functions?

Advantage:
Macros and Inline functions are efficient than calling a normal function. The times spend in calling the function is saved in case of macros and inline functions as these are included directly into the code.

Disadvantage:
Macros and inline functions increased the size of executable code.

17. Explain Difference between object oriented and object based languages?

object based languages doesnt support Inheritance where as object oriented supports. c# is a object oriented language because it supports inheritance and asp.net is not a langugae it is a technology

If the language supports ony 3 features i;e (data encapsulation,data abstraction $ polymorphism).then it is said to be object based programming language. If the language supports all the 4 features i;e(encapsulatio,abstraction,polymorphism $ also inheritance )..then it is said to be object oriented programming language.

18. Explain What are the features different in pSOS and vxWorks?

Actually theres not much of difference between using psos or vxworks.A few differences in features are:
1.The psos priority is reverse of vxworks.
2.psos supports posix 1003.1 while vxworks it is 1003.1b.
3.In psos device driver architecture is different than vxworks.
4.Also vxworks has interrupt
latency<4.33 microsecs while psos its higher.
Other then these both work in same manner and follow same
architecture.
Also as psos is getting killed no fresh development work is supported by windriver for psos. Also vxworks development environment is much more user friendly then psosenvironment becos vxworks IDE mimics mostly visual studio.

19. Explain Order of constructor and destructor call in case of multiple inheritance?

constructors top-down, destructors bottom-up.

eg:

in parent's constructor

in child's constructor

in grandchild's constructor

in grandchild's destructor

in child's destructor

in parent's destructor

20. Explain Operations involving unsigned and signed? unsigned will be converted to signed?

yes,

void foo(void)
{
unsigned int a = 6;
int b = -20;
(a+b > 6) ? puts("> 6") :
puts("<=6");
}

Here output would give you "> 6". The reason for this is that expressions involving signed and unsigned types have all operands
promoted to unsigned types

21. Explain What happens when recursion functions are declared inline?

Inline functions property says whenever it will called, it will copy the complete definition of that function. Recursive function declared as inline creates the burden on the compilers execution.

The size of the stack may/may not be overflow if the function size is big.