.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Patten/Practices >> Post New Question Subscribe to Interview Questions

Which is the design pattern that is type-safe and still extensible on runtime?

Posted By :Jean Paul     Posted Date :May 04, 2011    Points :40   Category :Patten/Practices 
Decorator Pattern design pattern that is type-safe and still extensible on runtime

You can also find related Interview Question to Which is the design pattern that is type-safe and still extensible on runtime?  below: 

Which design pattern to use if i needed to add additional responsibilities at runtime?

  
Decorator Pattern design pattern is use if i needed to add additional responsibilities at runtime (More...)

What is type safe?

  
Type safety is about increasing the opportunities for the compiler to detect your coding errors. If you use interfaces instead of delegates the compiler will have more opportunities to detect your coding errors. (More...)

Why .NET delegates are called type safe?

  
.NET delegates are type safe. If you will attempt to pass a delegate, a method that does not "match the pattern", you will receive a compile time error "Method does not match delegate pattern!". (More...)

Which design pattern should have private or protected constructor?

  
singleton design pattern should have private or protected constructor (More...)

You are designing a single person shooter game application. The player can choose between multiple guns.
1) Pistol with 5 bullets
2) Shotgun with 100 bullets
3) Grenade Launcher with 20 grenades

Each gun will have different sound effects and graphics.

Pressing Ctrl+Space should rotate between guns.
Which design pattern should you employ for this?

  
Use Strategy Pattern.

Explanation: Each gun having different performance and graphics.
So this can be accomodated in the algorithm.

Strategy pattern is best suited for shifting the guns/algorithms

There will be a IGun interface implemented by 3 classes
Pistol : IGun
Shotgun : IGun
GrenadeLauncher : IGun (More...)

What is design pattern?

  
Design pattern are recurring solution to the recurring problem.

There are basically classified in to three categories. They are,
1. Creational pattern
2. Structural pattern
3. Behavioural pattern.
(More...)

What is a Design Pattern?

  
Design Pattern is a re-usable, high quality solution to a given requirement, task or recurring problem. Further, it does not comprise of a complete solution that may be instantly converted to a code component, rather it provides a framework for how to solve a problem. (More...)

What is the Prototype Design Pattern?

  
A prototype design pattern relies on creation of clones rather than objects. Here, we avoid using the keyword 'new' to prevent overheads. (More...)

Can I get the name of the type at runtime?

  
Yes, using GetType the name of the type can be got (More...)

What are safe controls, and what type of information, is placed in that element in a SharePoint web.config file?

  
When you deploy a WebPart to SharePoint, you must first make it as a safe control to use within SharePoint in the web.config file. Entries made in the safe controls element of SharePoint are encountered by the SharePointHandler object and will be loaded in the SharePoint environment properly, those not will not be loaded and will throw an error.
In the generic safe control entry (this is general, there could be more), there is generally the Assembly name, the namespace, the public key token numeric, the typename, and the safe declaration (whether it is safe or not). There are other optional elements. (More...)

Is ArrayList is a type safe collection?

  
No, ArrayList is not a type safe collection because it allows you to add a any object. That means if you have one arrayList class object you can add in Integer, string, boolean, double etc value into one ArrayList class object.

for eg

ArrayList arr = new ArrayList();
arr("One");
arr.Add(1);
arr.Add(true); (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend