5374|12

633

帖子

0

TA的资源

裸片初长成(中级)

楼主
 

国外的嵌入式面试题,你做过么? [复制链接]

Embedded System Interview Questions:

Can structures be passed to the functions by value?
Why cannot arrays be passed by values to functions?
Advantages and disadvantages of using macro and inline functions?
What happens when recursion functions are declared inline?
Scope of static variables?
Difference between object oriented and object based languages?
Multiple inheritance - objects contain howmany multiply inherited ancestor?
What are the 4 different types of inheritance relationship?
How would you find out the no of instance of a class?
Is java a pure object oriented language? Why?
Order of constructor and destructor call in case of multiple inheritance?
Can u have inline virtual functions in a class?
When you inherit a class using private keyword which members of base class are visible to the derived class?
What is the output of printf("\nab\bcd\ref"); -> ef
#define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
Can you have constant volatile variable? Yes, you can have a volatile pointer?
++*ip increments what? it increments what ip points to
Operations involving unsigned and signed — unsigned will be converted to signed
a+++b -> (a++)+b
malloc(sizeof(0)) will return — valid pointer
main() {fork();fork();fork();printf("hello world"); } — will print 8 times.
Array of pts to functions — void (*fptr[10])()
Which way of writing infinite loops is more efficient than others? there are 3ways.
# error — what it does?
How is function itoa() written?
Who to know wether systemuses big endian or little endian format and how to convert among them?
What is interrupt latency?
What is forward reference w.r.t. pointers in c?
How is generic list manipulation function written which accepts elements of any kind?
What is the difference between hard real-time and soft real-time OS?
What is interrupt latency? How can you recuce it?
What is the differnce between embedded systems and the system in which rtos is running?
How can you define a structure with bit field members?
What are the features different in pSOS and vxWorks?
How do you write a function which takes 2 arguments - a byte and a field in the byte and returns the value of the field in that byte?
What are the different storage classes in C?
What are the different qualifiers in C?
What are the different BSD and SVR4 communication mechanisms
  Embedded System Interview Questions:
Can structures be passed to the functions by value?
Why cannot arrays be passed by values to functions?
Advantages and disadvantages of using macro and inline functions?
What happens when recursion functions are declared inline?
Scope of static variables?
Difference between object oriented and object based languages?
Multiple inheritance - objects contain howmany multiply inherited ancestor?
What are the 4 different types of inheritance relationship?
How would you find out the no of instance of a class?
Is java a pure object oriented language? Why?
Order of constructor and destructor call in case of multiple inheritance?
Can u have inline virtual functions in a class?
When you inherit a class using private keyword which members of base class are visible to the derived class?
What is the output of printf("\nab\bcd\ref"); -> ef
#define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
Can you have constant volatile variable? Yes, you can have a volatile pointer?
++*ip increments what? it increments what ip points to
Operations involving unsigned and signed — unsigned will be converted to signed
a+++b -> (a++)+b
malloc(sizeof(0)) will return — valid pointer
main() {fork();fork();fork();printf("hello world"); } — will print 8 times.
Array of pts to functions — void (*fptr[10])()
Which way of writing infinite loops is more efficient than others? there are 3ways.
# error — what it does?
How is function itoa() written?
Who to know wether systemuses big endian or little endian format and how to convert among them?
What is interrupt latency?
What is forward reference w.r.t. pointers in c?
How is generic list manipulation function written which accepts elements of any kind?
What is the difference between hard real-time and soft real-time OS?
What is interrupt latency? How can you recuce it?
What is the differnce between embedded systems and the system in which rtos is running?
How can you define a structure with bit field members?
What are the features different in pSOS and vxWorks?
How do you write a function which takes 2 arguments - a byte and a field in the byte and returns the value of the field in that byte?
What are the different storage classes in C?
What are the different qualifiers in C?
What are the different BSD and SVR4 communication mechanisms

最新回复

It doesn't matter, we will translate it into Chinese bit by bit. And, don't be afraid of English. Usually, technical English is easy to read and understand, the only difficulty is a few terminology. So take it easy   详情 回复 发表于 2009-12-22 12:59
点赞 关注
个人签名DIY是一种信仰~~

回复
举报

633

帖子

0

TA的资源

裸片初长成(中级)

沙发
 
Persional Prospectives:

Q1. No they are always passed by reference. Think. Size of structure can be arbitrarily large.
Q2. Same as above.
Q5. Lifetime of process.
Q9. Declare a static variable, class variable, and increment(decrement) for every constructor (destructor) called.
Q11. Constructor. Base to current. Destructor. current to base. Both are done recursuively.
Q13. NONE
Q14. $> acd
ef
->ef is wrong, what happened to acd?
Q16. You can have a constant pointer to a volatile variable but not a constant volatile variable.
Q26. Write a union of int and 2 chars. Store as int retrieve as chars.
Q 27. Time taken between INT req and INT service.
Q33. Study Let us C, Yeshwant Kanetkar

Tech Interviews comment by Taran

Q. 13
Answer posted is wrong.
Public & protected members of base class will be visible to derived class, but not its objects.

Tech Interviews comment by Sumeet

Q1 - YES, a complete structure can be passed. Regarding the size, it is true that they can be very large and hence it is not a good practice to do so. In any case, one can do if one wants to.

Tech Interviews comment by Bhaskar

Q3. When using macro you can’t use data type while passing it. But in Inline function you can have data types so that it can be checked.
e.g MACRO : ADD(a,b)
INLINE : inline void Add(int a,int b );

Tech Interviews comment by VijayaKumar

Q1. Yes structure can be passed by value but the overhead of copying large values will be there. hence not usable. We should pass it by pointer.
Q2. Individual element can be passed by value of course. But not whole array.
Q5. It is alive lifetime of process, and its scope is limited to function in which it is defined.
file1.c
**********
static int i;
void main()
{
……..
}
file2.c
**********
extern int i; //error

If declared global then it is visible in that file only.
Q6. Object oriented language have Inheritance, polymorphism etc. But object based language only deal with object.
Q7. If
class D:public A,B,C
{}
then three ancestors
Q8. public ,private, protected, virtual
Q30. Hard RTS is having deadline defined and it is life critical ,should be reliable. late answer is wrong answer. in Soft RTS,process time should be predictable and reliable.

Tech Interviews comment by Pawan Kumar

Q36.What are the different storage classes in C?
A:Auto,Register,Static,Extern

Tech Interviews comment by MKS

Q5 Scope of static variables is only within the block where it is declared.
But the lifetime is till the process is running

Tech Interviews comment by Satish Parande

Questin???

How can we dynamically allocate memory without using malloc() or calloc() or realloc()?Explain in Breif.

Can any one help in finding this answer to this question……

Tech Interviews comment by Midhun V

In Java, we place even the Main() function inside a CLASS.
But it is not the case with C++.

So, i think this is one of the answers you can say, JAVA is Fully Obejct Oriented.

Tech Interviews comment by vsvraju

Q11 : Base-class constructors are called in the order in which inheritance is specified in the derived-class definition. The order in which the Base-class constructors are specified in the derived-class member initializer list does not effect the order of construction.

Tech Interviews comment by vsvraju

Q 12:
Yes we can have.
you are never guaranteed that a routine is inlined. It is only a suggestion to the compiler. If
the routine is either too complicated or a virtual function,then a static copy of the routine will be placed in the compiled module. Thus, a routine that was coded as inline may cause a performance degradation because it may consume much more space when it is not physically inlined.
With a virtual function, a copy of that routine will be created for every module that has at least one instantiation of that class.

Q 13:
NONE.
None of the Public, Protected and Private data members are visible.

Q 16:
YES. We can have a const volatile variable.
a volatile variable is a variable which can be changed by the extrenal events (like an interrput timers will increment the voltile varible. If you dont want you volatile varibale to be changed then declare them as “const volatile”.

Q 17.
I will explain this with an example:

int a = 10;
int *p = &a;
// suppose &a = 4010 (address of a)

Because both ++ and * are unary operators, the are calculated from right to left –> ++ (*p)

++*p will inrement 4010 by 4 (int size) -> ++*p will have the value 4014.

Q 21:
It will print 8 times. Because, each fork will print twice.
if u flush, (using “fflush”), then it will be printed only once. thats is you need to flush the iostreams.

Q 30:

In Hard RTOS the latency should be less the 20ns (nano sec)
in Soft RTOS the latency range 3ns - 20ns is also acceptable.

Tech Interviews comment by vsvraju

I THINK A BALOON CAN HAVE TO MUCH ELECTRICITY

Tech Interviews comment by SANDRA

Java is not a pure object oriented language as “everything” in java is not an object. It still has primitive data types such as int, char, etc. which are NOT objects. Ruby is an example of a pure object oriented language, where “everything” is an object, even int.

Tech Interviews comment by Karan

16. It is possible to have “const volatile” declaration. This indicates that the variable defined like this is not possible to change within that context. It can be changed by an external event. const declaraion just says that it will be readonly within the context, that area can be modified by an interrupt routine or another process.

18. Operations involving unsigned and signed - The signed data will be converted to unsigned - Refer arithemetic conversion rules in K&R

24. #error is used for displaying an error while compilation. for eg.

#ifdef ABC
printf(”ABC”);
#else
#ifdef DEF
printf(DEF);
#else
#error “Declaration not done”
#endif

30. Hard RTOS is system which will be having major problems if the specified time limit is crossed. For eg. missiles
Soft RTOS is systems which will not be having major problems if the specified limit is crossed. For eg. real time audio steaming.
But for both exceeding the time limit is concidered as error.

31. Interrupt latency is the time period between interrupt on the pin to the execution of 1st instuction in the interrupt routine. THis will depend upon the processor. If the execution time for the instruction is less (like in RISC) this time will also be less. If register storage is required the time will be less in the processors in which remapping of registers is present as this can be done in a single instruction.

32. RTOS systems are embedded systems with time criticality.
33.

Tech Interviews comment by deepak

What is interrupt latency?
It is the time interval between an interrupt has occured till the time it has been serviced.
Mathematically:

Int(lat)= rt+pt+dt

where rt=recognition time
pt=process time
dt=dispatch time

Tech Interviews comment by Ramesh K.B.

Q. Write a function to reverse contents in a single linked list without reversing the links?
Can anyone pls help me out?

Tech Interviews comment by Ramesh K.B.

Q.Can we have a constant volatile variable?

Soln: YES.We can have a const volatile variable.
Volatile variable is one which can be changed by user,ie programmer as well as by the external events.If we declare it as const volatile,then user cannot change but can be changed by the hardware.

Tech Interviews comment by Ramesh K.B.

20.
malloc(sizeof(0)) will return — valid pointer
yes. sizeof(0) –> int size and it is 4

25.
itoa(…)
itoa(pointer to storage buffer,int to convert, base(eg.binary,oct,hex,dec))

33.
typedef struct regset{
unsigned char onebit:1;
unsigned char twobit:2;
….
}regset;

Tech Interviews comment by Ramesh.V

i have an query regarding , interupts in Embedded systems

can we use the interrupt function call same as ordinary function,i.e. can we pass arguments and return values from an ISR routine.

Tech Interviews comment by Sushil Rana

what happens when
we put an infinite loop using for

for(;;)
what is the condition expression value by default.

Tech Interviews comment by Sushil Rana

Write a function to reverse contents in a single linked list without reversing the links?
Can anyone pls help me out?

Count number of nodes in the linear linked list. Let say cnt is the number of nodes and index = 0. You can swap content of index th node and cnt-index th node, each time increment index by 1. All the contents will be reversed.

Tech Interviews comment by Hetal

Scope of static variables?
scope of static variables is limited to the local function in which it is defined and to the functions calling the stattic variable.

Tech Interviews comment by Guneet

How virtual tables are created in case of abstract classes? Is it the same as in non-abstract classes? Virtual tables r created on stack or Heap?

Tech Interviews comment by Satish Parande

why only reference is passed as a parameter in Copy constructor? why not address?

Tech Interviews comment by Satish Parande

is it possible to call delete from the class member function ?

Tech Interviews comment by Mrinmay Biswas

q.3.
—- Inline is only a request that may be rejected also based on optimization policies,while macro is immediately replaced before compilation.
—- type checking is not possible in Macros, but in inline its possible.

Tech Interviews comment by Praveen



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/embeddedsoft/archive/2006/10/25/1351278.aspx

赞赏

1

查看全部赞赏

 
个人签名DIY是一种信仰~~
 

回复

633

帖子

0

TA的资源

裸片初长成(中级)

板凳
 

回复 沙发 clark 的帖子

咱们先讨论第一个:Can structures be passed to the functions by value?
 
个人签名DIY是一种信仰~~
 
 

回复

49

帖子

0

TA的资源

一粒金砂(中级)

4
 

回复 板凳 clark 的帖子

No, it can't. If a argument in invoking a function, which were written as a structure in the source code, the compiler would generate instructions in which pass the address (pointer) of the structure to the function.

赞赏

1

查看全部赞赏

 
 
 

回复

1672

帖子

0

TA的资源

裸片初长成(初级)

5
 

回复 4楼 Ophidian 的帖子

Exactly!
 
 
 

回复

1672

帖子

0

TA的资源

裸片初长成(初级)

6
 

回复 5楼 richiefang 的帖子

Next question: Why cannot arrays be passed by values to functions?
 
 
 

回复

49

帖子

0

TA的资源

一粒金砂(中级)

7
 

回复 6楼 richiefang 的帖子

I think that the root cause is the mechanism of arguments passing for invoking functions.
You know, for different architecture of processor, such as x86, MIPS or PPC, the arguments would be passed through stack (x86), or general registers (MIPS/ARM/PPC). And, the size of either stack or general registers would be limited, so in fact, the argument such as an array or a sturcture, such as passed as a pointer (address).
Right?

赞赏

1

查看全部赞赏

 
 
 

回复

1672

帖子

0

TA的资源

裸片初长成(初级)

8
 

回复 7楼 Ophidian 的帖子

MM技术很厉害,英语也好,以后肯定能成为一个优秀的工程师。
 
 
 

回复

1672

帖子

0

TA的资源

裸片初长成(初级)

9
 

回复 4楼 Ophidian 的帖子

我来翻译下两个问题吧。
Q1:  结构体能以值的形式作为参数传递给函数吗?
A1: 不行。如果源码中,调用函数时参数是一个结构体,编译器生成的指令会传递结构体的地址(指针)给函数。

Q2: 为什么数组的值不能作为参数传给函数?
A2: 我觉得,根本原因是在于函数参数传递的机制。对于不同的体系结构,参数传递的方法不一样。对于x86是在栈中传递,而对于MIPS/ARM/PPC是利用通用寄存器。无论是栈,还是通用寄存器,他们的存储量是非常有限的,因此,实际上传递的是数组的指针(地址)。
 
 
 

回复

353

帖子

0

TA的资源

五彩晶圆(中级)

10
 
膜拜中。。
 
 
 

回复

1672

帖子

0

TA的资源

裸片初长成(初级)

11
 

继续讨论第三个问题?

Advantages and disadvantages of using macro and inline functions? 使用宏/内联函数的好处和坏处?
 
 
 

回复

1781

帖子

0

TA的资源

五彩晶圆(中级)

12
 
我英语不好,看不懂啊。。。。。
 
个人签名只有求知欲,没有求偶欲的人是植物,只有求偶欲,没有求知欲的人叫动物,既没求知欲,又没求偶欲的人是矿物。
 
 

回复

1672

帖子

0

TA的资源

裸片初长成(初级)

13
 
原帖由 wangjiafu1985 于 2009-12-22 12:01 发表
我英语不好,看不懂啊。。。。。

It doesn't matter, we will translate it into Chinese bit by bit. And, don't be afraid of English. Usually, technical English is easy to read and understand, the only difficulty is a few terminology. So take it easy
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表