DEV Community

Jason
Jason

Posted on

Interview question(s) about concepts you don't interact with often, if at all

Technical Interviews

TLDR: How do you answer a question in the interview where you've never found a use for the thing being asked about, so you never learned it?

I'm interested how others have handled this situation in a technical interview.

What do you say when asked about a specific technology/concept/keyword during a technical interview that you have never used so therefore you can't speak on it? Keep in mind, it probably wasn't listed in the job requirements either.

For example, I was asked

'What is the difference between var and dynamic?' (this is c# btw)

Honestly I didn't know. I use var all the time, but not dynamic. As I looked it up later, with the definition being

With var the type is set at compile time where as dynamic, type is set at run time.

That lead me to think

'Is dynamic something I'm missing out on? How have I gotten so far without ever using it?'

Further reading seems to indicate that

dynamic was primarily a way to allow C# to interop with languages such as Python, which is not statically typed

Ok, so I personally haven't done this, but this lead me to wonder

'Does this job do this often and that is why they asked?'.

Now, when I get asked this type of question I tend to answer it to the best of my abilities, and I now reply with

'Interesting question, I haven't found a use case for that. Can you explain when and how you've used this here?'

I'm not even being sarcastic, I honestly would like to know in what scenario they have used dynamic enough to warrant asking this. There is a limited amount of time in an interview to judge a candidate, why did you choose this concept?

Is it that important?

I've been asked the same question but with different technologies/concepts/keywords like 'Explain Delegates'. I know that a delegate is passing a function as a parameter, but I don't think I've ever typed

public delegate void MyDelegate(string msg);
Enter fullscreen mode Exit fullscreen mode

Does it have its uses, I think so but I've never used it and yet

  • my code compiles
  • my unit tests run
  • my work items get closed

So, after my long ramble, I would like to ask you dear reader?

How do you answer questions like this, when you haven't used the specific concept at all?

Top comments (4)

Collapse
 
unbalanced-tree profile image
Ravi Vijay

I have used dynamic when I have repetitive logic but with different data types.
For example:-
I have a collection of classes. I iterate through a file and get the class name from it with data collection. I add these data to their respective collection and change the collection if a new type Is found.

Collapse
 
k1pash profile image
Christopher Toman

It feels that C# has many ways of doing the same thing.

Delegates have the soul benefit from Actions and Funcs that their parameters can be named, so you can understand what code of someone else is about and how to use it.

I think they are testing you if you spend time periodically by studying the language even tho you are able do all your tasks and your job. Aka, if you seem to stagnate or if you are searching for a new tech, new features, new styles how to write etc. etc.

I'm just a junior btw, I'm not much experienced. I would have hard time answering those questions as well. But that's really because i know i write my code only in one style. I do not inovate my code. And I've been stagnating with my C# knowledge these past couple of years.

Collapse
 
dki19t profile image
Anton Khokhlov

Dynamic works well when you need to interact with old windows API like COM. You can use it whenever you don't know how the result of an operation will look like, for example, a call to poorly designed and documented API.

You can think about it as a dictionary, where the key is the name of some object's property and the value is the value of that property. When you work with JSON, for instance, you can add or remove properties to it. I would place dynamic near the goto operator. It's powerful, but only when you know perfectly what you are doing.

Some people mean all function-as-a-variable-of-some-kind stuff with the word "delegate." The main benefit of delegates is the ability to reference a piece of logic somewhere in your app. The simplest way to implement the "strategy" pattern in C# is probably to use delegates.

When somebody asks me a question about unfamiliar stuff, I admit that I don't know what it is / how to work with it / read about it long ago and never used it. For me, an interview is also a way to test my knowledge. Any question is a hint to revise something. The worst thing is when you know the answer, but you have failed to explain it to the interviewer.

Collapse
 
kj2whe profile image
Jason

Thank you for such a great response! You now have a new follower :D