Page 2 of 100
12.
What’s the difference between Move and LocationChanged?Resize and SizeChanged?
Both methods do the same, Move andResize are the names adopted from VB to ease migration to C#.13.
How would you create a non-rectangular window, let’s sayan ellipse?
Create a rectangular form, set the TransparencyKeyproperty to the same value as BackColor, which will effectively make thebackground of the form transparent. Then set the FormBorderStyle toFormBorderStyle.None, which will remove the contour and contents of the form.14.
How do you create a separator in the Menu Designer?
Ahyphen ‘-’ would do it. Also, an ampersand ‘&\’ would underline the nextletter.15.
How’s anchoring different from docking?
Anchoring treats thecomponent as having the absolute size and adjusts its location relativeto the parent form. Docking treats the component location as absoluteand disregards the component size. So if a status bar must always be atthe bottom no matter what, use docking. If a button should be on thetop right, but change its position with the form being resized, useanchoring.
Interview QuestionsC#
1.
What’s the implicit name of the parameter that gets passed intothe class’ set method?
Value, and its datatype depends on whatevervariable we’re changing.2.
How do you inherit from a class in C#?
Place a colon and then thename of the base class. Notice that it’s double colon in C++.3.
Does C# support multiple inheritance?
No, use interfaces instead.4.
When you inherit a protected class-level variable, who is itavailable to?
Classes in the same namespace.5.
Are private class-level variables inherited?
Yes, but they are notaccessible, so looking at it you can honestly say that they are notinherited. But they are.6.
Describe the accessibility modifier protected internal.
It’s availableto derived classes and classes within the same Assembly (and naturallyfrom the base class it’s declared in).7.
C# provides a default constructor for me. I write a constructorthat takes a string as a parameter, but want to keep the noparameter one. How many constructors should I write?
Two. Onceyou write at least one constructor, C# cancels the freebie constructor,and now you have to write one yourself, even if there’s noimplementation in it.8.
What’s the top .NET class that everything is derived from?
System.Object.9.
How’s method overriding different from overloading?
Whenoverriding, you change the method behavior for a derived class.Overloading simply involves having a method with the same name withinthe class.
Leave a Comment