.NET Windows Forms Interview Questions and Answers

  1. Write a simple Windows Forms MessageBox statement.
    System.Windows.Forms.MessageBox.Show
    ("Hello, Windows Forms");
  2. Can you write a class without specifying namespace? Which namespace does it belong to by default??
    Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you wouldn’t want global namespace.
  3. You are designing a GUI application with a window and several widgets on it. The user then resizes the app window and sees a lot of grey space, while the widgets stay in place. What’s the problem?
    One should use anchoring for correct resizing. Otherwise the default property of a widget on a form is top-left, so it stays at the same location when resized.
  4. How can you save the desired properties of Windows Forms application?
    .config files in .NET are supported through the API to allow storing and retrieving information. They are nothing more than simple XML files, sort of like what .ini files were before for Win32 apps.
  5. So how do you retrieve the customized properties of a .NET application from XML .config file?
    Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable.
  6. Can you automate this process?
    In Visual Studio yes, use Dynamic Properties for automatic .config creation, storage and retrieval.
  7. My progress bar freezes up and dialog window shows blank, when an intensive background process takes over.
    Yes, you should’ve multi-threaded your GUI, with taskbar and main form being one thread, and the background process being the other.
  8. What’s the safest way to deploy a Windows Forms app?
    Web deployment: the user always downloads the latest version of the code; the program runs within security sandbox, properly written app will not require additional security privileges.
  9. Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio?
    The designer will likely throw it away; most of the code inside InitializeComponent is auto-generated.
  10. What’s the difference between WindowsDefaultLocation and WindowsDefaultBounds? WindowsDefaultLocation tells the form to start up at a location selected by OS, but with internally specified size. WindowsDefaultBounds delegates both size and starting position choices to the OS.
  11. What’s the difference between Move and LocationChanged? Resize and SizeChanged?
    Both methods do the same, Move and Resize are the names adopted from VB to ease migration to C#.
  12. How would you create a non-rectangular window, let’s say an ellipse?
    Create a rectangular form, set the TransparencyKey property to the same value as BackColor, which will effectively make the background of the form transparent. Then set the FormBorderStyle to FormBorderStyle.None, which will remove the contour and contents of the form.
  13. How do you create a separator in the Menu Designer?
    A hyphen ‘-’ would do it. Also, an ampersand ‘&\’ would underline the next letter.
  14. How’s anchoring different from docking?
    Anchoring treats the component as having the absolute size and adjusts its location relative to the parent form. Docking treats the component location as absolute and disregards the component size. So if a status bar must always be at the bottom no matter what, use docking. If a button should be on the top right, but change its position with the form being resized, use anchoring.

Simple Questions:

  1. What is a static class?
  2. What is static member?
  3. What is static function?
  4. What is static constructor?
  5. How can we inherit a static variable?
  6. How can we inherit a static member?
  7. Can we use a static function with a non-static variable?
  8. How can we access static variable?
  9. Why main function is static?
  10.  

  11. How will you load dynamic assembly? How will create assesblies at run time?
  12. What is Reflection?
  13. If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) in my application?
  14. How do you create threading in.NET? What is the namespace for that?
  15. What do you mean by Serialize and MarshalByRef?
  16. What is the difference between Array and LinkedList?
  17. What is Asynchronous call and how it can be implemented using delegates?
  18. How to create events for a control? What is custom events? How to create it?
  19. If you want to write your own dot net language, what steps you will you take care?
  20. Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?
  21. How dot net compiled code will become platform independent?
  22. Without modifying source code if we compile again, will it be generated MSIL again?
  23. How does you handle this COM components developed in other programming languages in.NET?
  24. How CCW (Com Callable Wrapper) and RCW (Runtime Callable Wrappers) works?
  25. What are the new thee features of COM+ services, which are not there in COM (MTS)?
  26. What are the differences between COM architecture and.NET architecture?
  27. Can we copy a COM dll to GAC folder?
  28. What is Shared and Repeatable Inheritance?
  29. Can you explain what inheritance is and an example of when you might use it?
  30. How can you write a class to restrict that only one object of this class can be created (Singleton class)?
  31. What are virtual destructures?
  32. What is close method? How its different from Finalize and Dispose?
  33. What is Boxing and UnBoxing?
  34. What is check/uncheck?
  35. What is the use of base keyword? Tell me a practical example for base keyword’s usage?
  36. What are the different.NET tools which you used in projects?
  37. What will do to avoid prior case?
  38. What happens when you try to update data in a dataset in.NET while the record is already deleted in SQL Server as backend?
  39. What is concurrency? How will you avoid concurrency when dealing with dataset?
  40. One user deleted one row after that another user through his dataset was trying to update same row. What will happen? How will you avoid this problem?
  41. How do you merge two datasets into the third dataset in a simple manner?
  42. If you are executing these statements in commandObject. “Select * from Table1; Select * from Table2″ How you will deal result set?
  43. How do you sort a dataset.
  44. If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?
  45. What is the use of Parameter object?
  46. How to generateXML from a dataset and vice versa?
  47. How do you implement locking concept for dataset?
  48. How will you do Redo and Undo in TextBox control?
  49. How to implement DataGrid in.NET? How would you make a combo-box appear in one column of a DataGrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods. what is the access specifier used for that methods in the code behind file and why?
  50. How can we create Tree control in asp.NET?
  51. Write a program in C# to find the angle between the hours and minutes in a clock?
  52. Write a program to create a user control with name and surname as data members and login as method and also the code to call it.
  53. How can you read 3rd line from a text file?
  54. Explain the code behind wors and contrast that using the inline style.
  55. Explain different types of HTML, Web and server controls.
  56. What are the differences between user control and server control?
  57. How server form post-back works?
  58. Can the action attribute of a server-side
    tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page?
  59. How would ASP and ASP.NET apps run at the same time on the same server?
  60. What are good ADO.NET object to replace to ADO Recordset object.
  61. Explain the differences between Server-side code and Client-side code.
  62. What type of code(server or client) is found in a Code-Behind class?
  63. Should validation (did the user enter a real date) occur server-side or client-side? Why?
  64. What does the “EnableViewState” property do? Why would I want it on or off?
  65. What is the difference between Server.Transfer and response.Redirect? Why?
  66. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced.NET component?
  67. Let’s say I have an existing application written using VB6 and this application utilizes Windows 2000 COM+ transaction services. How would you approach migrating this application to.NET?
  68. If I am developing an application that must accomodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing). What would be the best approach to maintain login-in state for the users?
  69. What are ASP.NET web forms? How is this technology different than what is available though ASP(1.0-3.0)?
  70. How does VB.NET achieve polymorphism?
  71. How does C# achieve polymorphism?
  72. Can you explain what is Inheritance and an example in VB.NET and C# of when you might use it?
  73. Describe difference between inline and code-behind?
  74. What is loosely coupled solution in.NET?
  75. What is diffgram?
  76. Where would you use an iHTTPModule and what are the limitations of any approach you might take in implementing one?
  77. What are the Advantages and DisAdvantages of viewstate?
  78. Describe session handling in a webform, how does it work and what are the limitations?
  79. How would you get ASP.NET running in Apache web servers? Explain it’s limitations.
  80. What is MSIL and why should my developers need an appreciation of it if at all?
  81. Which methos do you invoke on the DataAdapter control to load your generated dataset with data?
  82. Can you edit data in Repeater control? How?
  83. Which template must you provide, in order to display data in a Repeater control?
  84. How can you provide an alternating color scheme in a Repeater control?
  85. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the repeater control?
  86. What base class do all web forms inherit from?
  87. What method do you use to explicitly kill a user’s session? How?
  88. How do you turn off cookies for one page in your site? Give an example.
  89. Which two properties are on every validation control?
  90. What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.
  91. How do you create a permanent cookie?
  92. What tag do you use to add a hyperlink column to the dataGrid?
  93. What is the standard you use to wrap up a call to a Web Service?
  94. Which method do you use to redirect the user to another page without performing a round trip to the client? How?
  95. What is the transport protocol you use to call a Seb Service SOAP?
  96. What does WSDL stand for?
  97. What property do you have to set to tell the grid which page to go to when using the Pager object?
  98. Where on the Internet would you look for Web Services?
  99. What tags do you need to add within the asp:datagrid tags to bind columns manually? How?
  100. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
  101. How is a property designated as read-only?
  102. Which control would you use if you needed to make sure the values in two different controls matched?
Posted in: Interview Questions General | Tags: interview questions and answers questions interview answers q&a .net c# c sharp xml winform rectangular window menu designer docking anchor dock deploy specify namespace config

New Feature in asp.net 4: Using Browser Capabilities Providers

In ASP.NET version 3.5 Service Pack 1, you can define the capabilities that a browser has in the following ways:

· At the machine level, you create or update a .browser XML file in the following folder:

\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\Browsers

After you define the browser capability, you run the following command from the Visual Studio Command Prompt in order to rebuild the browser capabilities assembly and add it to the GAC:

aspnet_regbrowsers.exe –I c

· For an individual application, you create a .browser file in the application’s App_Browsers folder.

These approaches require you to change XML files, and for machine-level changes, you must restart the application after you run the aspnet_regbrowsers.exe process.

ASP.NET 4 includes a feature referred to as browser capabilities providers. As the name suggests, this lets you build a provider that in turn lets you use your own code to determine browser capabilities.

In practice, developers often do not define custom browser capabilities. Browser files are hard to update, the process for updating them is fairly complicated, and the XML syntax for .browser files can be complex to use and define. What would make this process much easier is if there were a common browser definition syntax, or a database that contained up-to-date browser definitions, or even a Web service for such a database. The new browser capabilities providers feature makes these scenarios possible and practical for third-party developers.

There are two main approaches for using the new ASP.NET 4 browser capabilities provider feature: extending the ASP.NET browser capabilities definition functionality, or totally replacing it. The following sections describe first how to replace the functionality, and then how to extend it.

Posted in: asp.net | Tags: asp.net 4.0 config new feature broser capabilities providers provider gac aspnet_regbrowsers

55 screening questions for Windows admin

  1. What is Active Directory?
  2. What is LDAP?
  3. Can you connect Active Directory to other 3rd-party Directory Services? Name a few options.
  4. Where is the AD database held? What other folders are related to AD?
  5. What is the SYSVOL folder?
  6. Name the AD NCs and replication issues for each NC
  7. What are application partitions? When do I use them
  8. How do you create a new application partition
  9. How do you view replication properties for AD partitions and DCs?
  10. What is the Global Catalog?
  11. How do you view all the GCs in the forest?
  12. Why not make all DCs in a large forest as GCs?
  13. Trying to look at the Schema, how can I do that?
  14. What are the Support Tools? Why do I need them?
  15. What is LDP? What is REPLMON? What is ADSIEDIT? What is NETDOM? What is REPADMIN?
  16. What are sites? What are they used for?
  17. What’s the difference between a site link’s schedule and interval?
  18. What is the KCC?
  19. What is the ISTG? Who has that role by default?
  20. What are the requirements for installing AD on a new server?
  21. What can you do to promote a server to DC if you’re in a remote location with slow WAN link?
  22. How can you forcibly remove AD from a server, and what do you do later? • Can I get user passwords from the AD database?
  23. What tool would I use to try to grab security related packets from the wire?
  24. Name some OU design considerations.
  25. What is tombstone lifetime attribute?
  26. What do you do to install a new Windows 2003 DC in a Windows 2000 AD?
  27. What do you do to install a new Windows 2003 R2 DC in a Windows 2003 AD?
  28. How would you find all users that have not logged on since last month?
  29. What are the DS* commands?
  30. What’s the difference between LDIFDE and CSVDE? Usage considerations?
  31. What are the FSMO roles? Who has them by default? What happens when each one fails?
  32. What FSMO placement considerations do you know of?
  33. I want to look at the RID allocation table for a DC. What do I do?
  34. What’s the difference between transferring a FSMO role and seizing one? Which one should you NOT seize? Why?
  35. How do you configure a “stand-by operation master” for any of the roles?
  36. How do you backup AD?
  37. How do you restore AD?
  38. How do you change the DS Restore admin password?
  39. Why can’t you restore a DC that was backed up 4 months ago?
  40. What are GPOs?
  41. What is the order in which GPOs are applied?
  42. Name a few benefits of using GPMC.
  43. What are the GPC and the GPT? Where can I find them?
  44. What are GPO links? What special things can I do to them?
  45. What can I do to prevent inheritance from above?
  46. How can I override blocking of inheritance?
  47. How can you determine what GPO was and was not applied for a user? Name a few ways to do that.
  48. A user claims he did not receive a GPO, yet his user and computer accounts are in the right OU, and everyone else there gets the GPO. What will you look for?
  49. Name a few differences in Vista GPOs
  50. Name some GPO settings in the computer and user parts.
  51. What are administrative templates?
  52. What’s the difference between software publishing and assigning?
  53. Can I deploy non-MSI software with GPO?
  54. You want to standardize the desktop environments (wallpaper, My Documents, Start menu, printers etc.) on the computers in one department. How would you do that?
  55. What do you do to install a new Windows 2003 DC in a Windows 2000 AD?
Posted in: Interview Questions | Tags: windows config configuration windows admin admin sys partion ad microsoft ad active directory kcc ldp gc gcs windows 2003 windows 2008 server rid dc ds life time