programming languages Online Quiz - 183
Description: programming languages Online Quiz - 183 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
You have been reading the Gang of Four pattern book again and you suddenly notice a similarity between a design pattern and publish-subscribe messaging. What design pattern is similar to publish-subscribe messaging?
In which of the following situations would you use the Observer pattern?
You need to access a complex object in a recursive way…building the object from other objects. This is an example of which pattern?
When would you use the Flyweight pattern?
When would you use the Mediator pattern?
What are the benefits of using the Service Locator pattern?
You are designing a complex set of classes that provides a secure framework for other programmers to use. The idea behind this framework is that it will allow other programmers to write secure programs without getting bogged down with the complexities of writing secure applications. What sort of design pattern is being used here?
What is the difference between the abstract factory pattern and the factory method pattern?
You're designing a paint application and as part of the user interface you have a toolbar along the left hand side of the screen. Each of the icons on the toolbar has different actions when you are using different tools. The way you've structured it, the application is required to pass commands from one object to another. When the appropriate object receives the command, it handles the request. This is an example of which pattern?
Which design pattern can be used to create a family of dependent objects?
You can traverse through the elements of many Java Collection objects because they provide a way to access their elements sequentially. What design pattern is used here?
Compact Computers is a small computer assembly company. Any customer currently has the following choices for a PC: (i) 800 MHz processor, 40 GB HDD, 128 MB RAM (ii) 1 GHz processor, 60 GB HDD, 256 MB RAM (iii) 1.2 GHz processor, 80 GB HDD, 512 MB RAM The use of what design pattern would ensure that only the legal combinations could be sold?
A Philadelphia based cable company is using J2EE for their Customer Management system. The system uses a combination of HTML and JSP for presentation. Java Servlets are used as Controllers. All Servlets have access to a ServletContext object, which functions as a Container to the shared resources of the Servlets. The ServletContext object best exemplifies what design pattern?
Compact Computers is a small computer assembly company. Its online application allows customers to pick and choose accessories to build their own PCs. The accessories are: i. Processor - 800Mhz, 1Ghz, 1.2Ghz ii. HDD - 40 GB, 60 GB, 80 GB iii. Memory - 128 MB, 256 MB, 512 MB Customers choose parts and quantities during the order. For example, a customer could choose a second HDD as a secondary hard drive or purchase additional RAM. What design pattern may be optimal for implementing a suitable design here?
package constructors; class R { R() { } } class S extends R { int p ; S() { this(10); super(); System.out.println("I am in Q"); } S(int p) { this.p = p; System.out.println("I am in Q with Argument"); } } public class TestConstructor4 { Q q = new Q(); }
package constructors; class U { U() { System.out.println("I am in U"); } } class V extends U { void V() { System.out.println("I am in V"); } } public class TestConstructor5 { public static void main(String[] args) { V v = new V(); } }
package constructors; class A { A() { System.out.println("I am in A"); } } class B extends A { B() { System.out.println("I am in B"); } } class C extends B { C() { System.out.println("I am in C"); } } public class TestConstructor1 { public static void main(String[] args) { C c = new C(); } }
package constructors; class P { P(String a) { System.out.println("I am in P "+a); } } class Q extends P { Q() { System.out.println("I am in Q"); } } public class TestConstructor2 { Q q = new Q(); }
package constructors; class M { int i; M() { System.out.println("I am in M, No argument Constructor"); this(10); } M(int i) { this.i = i; System.out.println("I am in M, Constructor with Argument"); } } public class TestConstructor3 { M m = new M(); }
What is the output of the following code snippet ?? void main() { printf("%d", sizeof(2.0)); }