Design World

  • Home
  • Technologies
    • 3D CAD
    • Electronics • electrical
    • Fastening & Joining
    • Factory automation
    • Linear Motion
    • Motion Control
    • Test & Measurement
    • Sensors
    • Fluid power
  • Learn
    • Ebooks / Tech Tips
    • Engineering Week
    • Future of Design Engineering
    • MC² Motion Control Classrooms
    • Podcasts
    • Videos
    • Webinars
  • LEAP AWARDS
  • Leadership
    • 2022 Voting
    • 2021 Winners
  • Design Guide Library
  • Resources
    • 3D Cad Models
      • PARTsolutions
      • TraceParts
    • Digital Issues
      • Design World
      • EE World
    • Women in Engineering
  • Supplier Listings

The 0x10 Best Questions for Would-be Embedded Programmers  

By Aimee Kalnoskas | September 29, 2014

Share

Trying to decide if your potential new embedded programmer hire has what it takes? Need a little help with embedded-specific interview questions? Or do you simply want to take a break and have fun with a test?
Electro-Tech-Online member known as amol. guilhane07 has compiled 16 questions to ask  when recruiting embedded systems programmers. We list the questions here — but we aren’t giving you the answers right away. Try the test yourself and then follow the link at the end to Amol’s pdf with questions and answers. Let us know how you did and if you found the questions useful. 

Tip: Click the code for a clearer image in a new window.

An obligatory and significant part of the recruitment process for embedded systems programmers seems to be the ‘C Test’. Over the years, I have had to both take and prepare such tests and in doing so have realized that these test can be very informative for both the interviewer and interviewee. Furthermore, when given outside the pressure of an interview situation, they can also be quite entertaining (hence, this article).

From the interviewer’s perspective, you can learn a lot about the person that has written or administered the test. Is the test designed to show off the writer’s knowledge of the minutiae of the ANSI standard rather than to test practical know-how? Does it test ludicrous knowledge, such as the ASCII values of certain characters? Are the questions heavily slanted towards your knowledge of system calls and memory allocation strategies indicating the writer may spend his time programming computers instead of embedded systems? If any of these are true, then I know I would seriously doubt whether I want the job in question.

From the interviewer’s perspective, a test can reveal several things about the candidate. Primarily, one can determine te level of the candidate’s knowledge of C. However, it is also very interesting to see how the person reasons to choices, backed up with some good intuition, or do they just guess? Are they defensive when they are stumped, or do they exhibit a real curiosity about the problem, and see it as an opportunity to learn something? I find this information as useful as their raw performance on the test.

With these ideas in mind, I have attempted to construct a test that is heavily slanted towards the requirements of embedded systems. This is lousy test to give to someone seeking a job writing compliers! The questions are almost all drawn from situations I have encountered over the y ears. Some of them are very tough, however, they should all be informative.

This test may be given to a wide range of candidates. Most entry-level applicants will do poorly on this test, while seasoned veterans should do very well. Points are not assigned to each question, as this tends to arbitrarily weight certain questions. However, if you choose to adapt this test for your own use, feel free to assign test scores.

Preprocessor

Q1:
Using the #define statement, how would you declare a manifest contact that return the number of seconds in year? Disregard leap years in your answer.

Q2:
Write the “standard” MIN macro. That is, a macro that takes two arguments and returns the smaller of the two arguments

Q3: What is the purpose of the preprocessor directive #error?

 

Infinite Loops

Q4: Infinite loops often arise in embedded systems. Howe does one code an infinite loop in C?

 

Data Declarations:

Q5: Using the variable a, write down definitions of the following:

  1. An integer
  2. A pointer to an integer
  3. A pointer to a pointer to an integer
  4. An array of ten integers
  5. An array of ten pointers to integers
  6. A pointer to an array of ten integers
  7. A pointer to a function that takes an integer as an argument and returns an integer
  8. An array of ten pointers to functions that take an integer argument and return an integer

 

Static

Q6: What are the uses of the keyword static?

Q7: What does the keyword “const” mean?

Q7.1: What do the following incomplete declarations mean?

const  int   a ;

int  const  a ;

const  int   *a ;

int  *  const   a ;

int  const   *  a  const ;

 

Volatile

Q8: What does the keyword volatile mean? Give three examples of its use.

Q8.1:

(a) Can a parameter be both const and volatile? Explain your answer.
(b) Can a pointer be volatile? Explain your answer.
(c) What is wrong with the following function?:

code_Q8.1

Bit Manipulation

Q9:
Embedded systems always require the user to manipulate bit sin registers or variables. Given an integer variable a, write two code fragments. The first should set bit 3 of a. The second should clear bit 3 of a. In both cases, the remaining bits should be unmodified.

 

Accessing Fixed Memory Locations

Q10: Embedded systems are often characterized by requiring the programmer to access a specific memory location. On a certain project, it is required to set an integer variable at the absolute address 0x67x9 to the value 0xaa55. The compiler is a purse ANSI compiler. Write code to accomplish this task.

 

Interrupts

Q11:
Interrupts are an important part of embedded systems. Consequently, many compiler vendors offer an extension to standard C to support interrupts. Typically, this new keyword is  interrupt. The following code uses  interrupt to define an interrupt service routine. Comment on the code:

code_Q11

Code Examples

Q12: What does the following code output and why?

code_Q12

Q13: Comment on the following code fragment:

code_Q13

Dynamic Memory Allocation

Q14: Although not as common as in non-embedded computer, embedded systems still do dynamically allocate memory from the heap. What are the problems with dynamic memory allocation in embedded systems?

Q15: Typedef is frequently used in C to declare synonyms for pre-existing data types. It is also possible to use the preprocessor to do something similar. For instance, consider the following code fragment

code_Q15

The intent in both cases is to define dPS and tPS to be pointers to structure s. Which method (if any) is preferred and why?

 

Obfuscated syntax

A16: C allows some appalling constructs. Is this construct legal, and if so what does this code do?

code_Q16

 

 

You’re done! Download the original pdf here with the questions and answers.

Do you have questions of your own that you either you used in recruiting — or that were used on you? Share in the comments below and we’ll put them together in another future post.


 

References

  1. In Praise of the #error directive. ESP September 1999.
  2. Efficient C Code for Eight-Bit MCUs, ESP November 1988.

The post The 0x10 Best Questions for Would-be Embedded Programmers   appeared first on Micro Controller Tips.


Filed Under: TECHNOLOGIES + PRODUCTS

 

Related Articles Read More >

55417-edgeConnectoren_V3.0_05-2022_cmyk_300dpi
edgeConnector product family from Softing now include a REST API
Screenshot 2022-05-10 at 12.00.35 PM
FAULHABER: Everything under control
Rockwell Automation offers new online capabilities with industrial automation software
NYE adds Vishay Miniature Position Sensor to product lineup

DESIGN GUIDE LIBRARY

“motion

Enews Sign Up

Motion Control Classroom

Design World Digital Edition

cover

Browse the most current issue of Design World and back issues in an easy to use high quality format. Clip, share and download with the leading design engineering magazine today.

EDABoard the Forum for Electronics

Top global problem solving EE forum covering Microcontrollers, DSP, Networking, Analog and Digital Design, RF, Power Electronics, PCB Routing and much more

EDABoard: Forum for electronics

Sponsored Content

  • Global supply needs drive increased manufacturing footprint development
  • How to Increase Rotational Capacity for a Retaining Ring
  • Cordis high resolution electronic proportional pressure controls
  • WAGO’s custom designed interface wiring system making industrial applications easier
  • 10 Reasons to Specify Valve Manifolds
  • Case study: How a 3D-printed tool saved thousands of hours and dollars

Design World Podcasts

May 17, 2022
Another view on additive and the aerospace industry
See More >
Engineering Exchange

The Engineering Exchange is a global educational networking community for engineers.

Connect, share, and learn today »

Design World
  • Advertising
  • About us
  • Contact
  • Manage your Design World Subscription
  • Subscribe
  • Design World Digital Network
  • Engineering White Papers
  • LEAP AWARDS

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Design World

  • Home
  • Technologies
    • 3D CAD
    • Electronics • electrical
    • Fastening & Joining
    • Factory automation
    • Linear Motion
    • Motion Control
    • Test & Measurement
    • Sensors
    • Fluid power
  • Learn
    • Ebooks / Tech Tips
    • Engineering Week
    • Future of Design Engineering
    • MC² Motion Control Classrooms
    • Podcasts
    • Videos
    • Webinars
  • LEAP AWARDS
  • Leadership
    • 2022 Voting
    • 2021 Winners
  • Design Guide Library
  • Resources
    • 3D Cad Models
      • PARTsolutions
      • TraceParts
    • Digital Issues
      • Design World
      • EE World
    • Women in Engineering
  • Supplier Listings