Is it OK to mix C and C++ in an interview? [closed]

If I am asked in an interview to write down some code, should I completely stick with C++ or is it acceptable to “mix” the two to write easy code as it comes to my mind?

I’ll explain it: if I’m asked to create a “stack” data type, a C++ class is perfectly suited, while if I need to parse some strings a strtok/sscanf is far easier than STL. On the other hand, if I need a generic container STL and templates are the way to go.

Everything can be done in C or in C++, but in an interview I can’t code everything or remember every standard/STL function. What is an acceptable tradeoff?

6

To be really pedantic, the C++ offers supports for C, natively, maybe only a subset, but if the topic is the C++ the C programming language is included, and this is not an opinion, i would expect no arguments on that in a professional environment.

1

Unless specified, most programming questions will let you use whatever language you want when answering a specific question. You may want to explain which language you are using to answer the specific question to avoid confusion and explain why you are using it.

If you are not sure if this will be OK with the interviewer, ask – it is absolutely acceptable to ask if you can answer different questions using different languages (in most on-paper answers, pseudo-code will be more than acceptable).

3

You should just ask to the interviewer what he prefer, if you know how to use both.

Depending on his answer you can discover:

  1. if he really know the differences between C and C++;
  2. if he knows about C++ standard library;
  3. if it’s important to him.

There is no generic answer to this question. It’s too dependent on the job and the objectives of the recruiter. If he wants you to show language knowledge then he will be specific. If he want you to show you problem solving skills, and communication skills, then he will not really care.

Unless your interviewer explicit request that you code in C or C++, I would just use what ever is appropriate for the interview.

For me, if my candidate was mixing the two up, I would be more interested in his strategy or reason for mixing the two language. Having someone on my team that can provide a solution and be able to justify the solution is extremely valuable.

1

If I am asked in an interview to write down some code, should I completely stick with C++ or is it acceptable to “mix” the two to write easy code as it comes to my mind?

That entirely depends on what kind of job you are applying for and which language they expect you to use. Generally, if you are writing C++, it is best to stick to C++ as far as possible. I would however expect every C++ programmer to know at least a bit of C (and vice versa).

I’ll explain it: if I’m asked to create a “stack” data type, a C++ class is perfectly suited, while if I need to parse some strings a strtok/sscanf is far easier than STL. On the other hand, if I need a generic container STL and templates are the way to go.

If they expect you to write a whole working data type during the interview, you should be wary. It is good if they ask you about technical details, but if they expect you to spend hours of writing programs during the interview, that likely says something bad about the employer.

If you use scanf(), you have probably made a big mistake no matter if C or C++. You better explain to the interviewer that you are just writing something quick & dirty and would never use scanf in production code. There are many pit falls with various C library functions.

The interviewer shouldn’t expect you to remember every function in the C and C++ standard librarier, but they should expect you to know which ones that are blatantly dangerous. gets(), getchar(), scanf(), setjmp() etc.

1

I think that when you are actually explicitly asked to do a short assignment in C++, it would be of utmost importance to actually stick with C++ and not mix C with it. Modern C is not a subset of modern C++, as such mixing the two would only imply that you aren’t very familiar with what clean, modern C++ is like.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật