Sie sind auf Seite 1von 30

1. Why do we need singleton pattern?

Answer:

OR Describe applicability of Singleton Pattern?


Answer:
Use the Singleton pattern when there must be only one instance of a class,
and it must be accessible to clients from a well- known access point.

When the sole instance should be extensible by sub classing, and clients
should be able to use an extended instance without modifying their code.

 Why do we need Factory pattern?


Answer: Factory method is a creational design pattern, i.e., related to object
creation.

In Factory pattern, we create object without exposing the creation logic to


client and the client use the same common interface to create new type of
object.

The idea is to use a static member-function (static factory method) which


creates & returns instances, hiding the details of class modules from user.

May be the most used pattern in modern languages like java.


OR Describe applicability of Factory Pattern?
Answer: Use the Factory Method pattern when
 A class can’t anticipate which kind of class of objects it must create.
 A class uses its subclasses to specify which objects it creates.
 You want to localize the knowledge of which class gets created.

Why do we need Composite Pattern?

Answer:

Compose objects into tree structures to represent part-whole


hierarchies.
Composite lets clients treat individual objects and compositions of
objects uniformly.

File system: folder, file operation

Describe applicability of Composite Pattern?

Answer: Use the Composite pattern when

You want to represent part-whole hierarchies of objects.


You want clients to be able to ignore the difference between
compositions of objects and individual objects. Clients will treat all
objects in the composite structure uniformly.

2. Write simple java code for Singleton with explanation?

Answer: Implementing Singleton class with method name as that of class


name

// Java program implementing Singleton class


// with method name as that of class
class Singleton
{
// static variable single_instance of type Singleton
private static Singleton single_instance=null;

// variable of type String


public String s;

// private constructor restricted to this class itself


private Singleton()
{
s = "Hello I am a string part of Singleton class";
}

// static method to create instance of Singleton class


public static Singleton Singleton()
{
// To ensure only one instance is created
if (single_instance == null)
{
single_instance = new Singleton();
}
return single_instance;
}
}

// Driver Code
class Main
{
public static void main(String args[])
{
// instantiating Singleton class with variable x
Singleton x = Singleton.Singleton();

// instantiating Singleton class with variable y


Singleton y = Singleton.Singleton();

// instantiating Singleton class with variable z


Singleton z = Singleton.Singleton();
// changing variable of instance x
x.s = (x.s).toUpperCase();

System.out.println("String from x is " + x.s);


System.out.println("String from y is " + y.s);
System.out.println("String from z is " + z.s);
System.out.println("\n");

// changing variable of instance x


z.s = (z.s).toLowerCase();

System.out.println("String from x is " + x.s);


System.out.println("String from y is " + y.s);
System.out.println("String from z is " + z.s);
}
}

Explanation: In the Singleton class, when we first time call Singleton() method, it
creates an object of class Singleton with name single_instance and return it to the
variable. Since single_instance is static, it is changed from null to some object.
Next time if we try to call Singleton() method, since single_instance is not null, it
is returned to the variable, instead of instantiating the Singleton class again.

 Write simple java code for Factory with explanation?

Answer:

class Namer {

protected String last; //store last name here

protected String first; //store first name here

public String getFirst() {

return first;
}

public String getLast() {

return last;

class FirstLast extends Namer {

public FirstLast(String s) {

int i = s.lastIndexOf(" "); //find sep space

if (i > 0) {

first = s.substring(0, i).trim();

last =s.substring(i+1).trim();

else {

first = “”; // put all in last name if no space

last = s;

}}

class LastFirst extends Namer {

public LastFirst(String s) {

int i = s.indexOf(","); //find comma

if (i > 0) {
last = s.substring(0, i).trim();

first = s.substring(i + 1).trim();

else {

last = s; // put all in last name if no comma

first = "";

class NameFactory {

public Namer getNamer(String entry) {

int i = entry.indexOf(",");

if (i>0)

return new LastFirst(entry); //return one class

else

return new FirstLast(entry); //or the other

NameFactory nfactory = new NameFactory();

private void computeName() {

//send the text to the factory and get a class back


namer = nfactory.getNamer(entryField.getText());

txFirstName.setText(namer.getFirst());

txLastName.setText(namer.getLast());

 Write a simple java code for composite pattern?

Answer:
3. Describe Class Diagram Machine?
Answer: Class diagrams are the main building block in object-oriented modeling.
They are used to show the different objects in a system, their attributes, their
operations and the relationships among them.
The following figure is an example of a simple class:

In the example, a class called “loan account” is depicted. Classes in class diagrams
are represented by boxes that are partitioned into three:

1. The top partition contains the name of the class.


2. The middle part contains the class’s attributes.
3. The bottom partition shows the possible operations that are associated with
the class.

The example shows how a class can encapsulate all the relevant data of a particular
object in a very systematic and clear way. A class diagram is a collection of classes
similar to the one above.

Describe Sequence Diagram Machine?


Answer: This sequence diagram tutorial is to help you understand sequence
diagrams better; to explain everything you need to know, from how to draw a
sequence diagram to the common mistakes you should avoid when drawing one.

There are 3 types of Interaction diagrams; Sequence diagrams, communication


diagrams, and timing diagrams.
Describe Behavioral State Diagram Machine?

 Answer: A behavioral state machine diagram is a dynamic model that shows


the different states that a single class passes through during its life in
response to events, along with its responses and actions.

Typically, behavioral state machine diagrams are not used for all classes, but just
to further define complex classes to help simplify the design of algorithms for their
methods
4. What is temporal event? How many “Actors” can be in use case modeling?
Describe briefly.
Answer: An event that occurs as a result of a reaching a point in time.
5. How many “Associations” can be in use case modeling? Describe briefly.
Answer:
6. .How to create a use-case diagram/modeling? Draw a sample use-case
diagram explaining its elements.
Ans: A use case diagram summarizes all of the use cases (for the part of the
system being modeled) together in one picture.
Creating a Use Case Diagram: Steps in creating a use case diagram
1. Identify use cases.
2. Draw the system boundary.
3. Place the use cases on the diagram.
4. Identify the actors.
5. Add association relationships.

Example:
7. What is SDLC? Describe stages of SDLC.
Ans: SDLC: The systems development life cycle (SDLC), also referred to as the
application development life-cycle, is a term used in systems engineering,
information systems and software engineering to describe a process for planning,
creating, testing, and deploying an information system.[1] The systems development
lifecycle concept applies to a range of hardware and software configurations, as a
system can be composed of hardware only, software only, or a combination of
both.[2] There are usually six stages in this cycle: analysis, design, development and
testing, implementation, documentation, and evaluation.
 The SDLC is composed of four fundamental phases:
• Planning: This phase is the fundamental process of understanding
why an information system should be built, and determining how the
project team will go about building it.
• Analysis: The analysis phase answers the questions of who will use
the system, what the system will do, and where and when it will be
used. During this phase the project team investigates any current
system(s), identifies improvement opportunities, and develops a
concept for the new system.
• Design: The design phase decides how the system will operate, in
terms of the hardware, software, and network infrastructure; the user
interface, forms, and reports that will be used; and the specific
programs, databases, and files that will be needed.
• Implementation: During the implementation phase, the system is
either developed or purchased (in the case of packaged software) and
installed. This phase is usually the longest and most expensive part of
the process.

8. Describe/Mention System Analysts roles and skills


Ans: Systems Analyst Roles:
 System analyst - Focuses on the IS issues surrounding the system.
 Business analyst - Focuses on the business issues surrounding the system.
 Infrastructure analyst - Focuses on technical issues
 Change management analyst - Focuses on the people and management
issues surrounding the system installation.
 Project manager - Ensures that the project is completed on time and within
budget, and that the system delivers the expected vale to the organization.
Systems Analyst Skills:
 Technical – Must understand the technical environment, technical
foundation, and technical solution.
 Business – Must understand how IT can be applied to business situations.
 Analytical – Must be problem solvers.
 Interpersonal – Need to communicate effectively.
 Management – Need to manage people and to manage pressure and risks.
 Ethical - Must deal fairly, honestly, and ethically with other project
members, managers, and systems users.
9. Describe Data flow diagram mentioning its elements along with drawing a
sample diagram.
Ans: Data flow diagramming is a technique that diagrams the business processes
and the data that pass among them.
Elements of Data Flow Diagrams:
 Process – A process is an activity or a function performed for some specific
business reason.
 Data Flow – A data flow is a single piece of data, or a logical collection of
several pieces of information.
 Data Store – A data store is a collection of data that is stored in some way.
 External Entity – An external entity is a person, organization, organization
unit, or system that is external to the system, but interacts with it.
Example
17. What are the elements of Use-case/Class/Sequence/Behavioral machine
diagram? Describe briefly.
Ans: Use Case:
Class:
Sequence:
State:
18. How can we validate an ERD? Mention any 3 general design guidelines in
creating ERD.
Ans: VALIDATING AN ERD:
 General design guidelines.
 Normalization.
 Check the ERD against the process models to make sure that both model
balance each other.
Design Guidelines:

19. What is system architecture design in SAD? Mention key


factors/objectives of system?
Ans: Architecture design: Plans for how the system will be distributed across
multiple computers and what hardware, operating system software, and application
software will be used for each computer is called Architecture design.

Key factors in architecture design: Nonfunctional requirements developed early in


the

Analysis phase play a key role in architecture design.

20. What is custom development? Describe pros and cons of “Custom


development”?

Ans: Custom development – When we build a new system from scratch then it’s
called custom development.

 Pros of custom development:

-It allows developers to be flexible and creative in the way they solve business
problems.

- It allows to take advantage of current technologies that can support strategic


efforts.

- It builds technical skills and functional knowledge within the organization.

 Cons of custom development:

- It requires a dedicated effort that include long hours and hard work.

- It requires a variety of skills, but high skilled IS professionals are difficult to hire
and retain.

- The risks associated with building a system from the ground up can be quite high.

21. Describe risk of outsourcing?


Ans: Outsourcing means hiring an external vendor, developer, or service provider
to create or supply the system.

Risks of outsourcing:

*Compromising confidential information

*Losing control over future development

*Losing important skills of in-house professionals.

So,you should never outsource what you do not understand and carefully choose an
outsourcing firm with a proven track record.

22. What is cloud computing? Advantages of cloud-computing?

Ans: Cloud computing: – everything from computing power to computing


infrastructure, applications, business processes to personal collaboration can be
delivered as a service wherever and whenever needed. The word “cloud” can be
defined as the set of hardware, networks, storages, devices, and interfaces that
combine to deliver aspects of computing as a service.

Advantages of cloud computing:

1. The resources allocated can be increased or decreased based on demand.

2. Cloud customers can obtain cloud resources in a straightforward fashion.

3. Cloud services typically have standardized APIs (application program


interfaces).

4. The cloud computing model enables customers to be billed for resources as they
are used.
23. Describe virtualization concept?

Ans: Virtualization: In computing, virtualization refers to the act of creating a


virtual (rather than actual) version of something, including virtual computer
hardware platforms, storage devices, and computer network resources.

Hardware virtualization or platform virtualization refers to the creation of a virtual


machine that acts like a real computer with an operating system. Software executed
on these virtual machines is separated from the underlying hardware resources. For
example, a computer that is running Microsoft Windows may host a virtual
machine that looks like a computer with the Ubuntu Linux operating system;
Ubuntu-based software can be run on the virtual machine.

In hardware virtualization, the host machine is the machine which is used by the
virtualization and the guest machine is the virtual machine. The words host and
guest are used to distinguish the software that runs on the physical machine from
the software that runs on the virtual machine. The software or firmware that creates
a virtual machine on the host hardware is called a hypervisor or virtual machine
monitor.

24. You will be given some system requirements. You have to find appropriate
requirement type?

Ans: A requirement is a statement of what the system must do or what


characteristics it needs to have.

Requirements describe: what the business needs (business requirements), what the
users need to do (user requirements), what the software should do (functional
requirements), characteristics the system should have (non-functional
requirements).
25. Why do we need testing? Describe Unit/integration/system/acceptance
testing?
Ans: SOFTWARE TESTING LEVELS are the different stages of the software
development lifecycle where testing is conducted.
#There are four levels of software testing: Unit >> Integration >> System >>
Acceptance.
Unit Testing Unit tests focus on one unit – a program or a program module
that performs a specific function that can be tested.
There are two approaches to unit testing:
- Black-box testing: The test plan is developed directly from the program
specification.
- White-box testing: The tester reviews the actual program code.

Integration Testing Integration tests assess whether a set of modules or


programs that must work together do so without error.
There are four approaches to integration
Testing:
- User interface testing,
- use scenario testing,
- Data flow testing, and
- System interface testing.

System Testing System tests are usually conducted by the systems analysts to
ensure that all modules and programs work together without error.
System tests examine:
- How well the system meets business requirements,
- Usability,
- Security,
- Performance under heavy load, and
- System’s documentation.

Acceptance Testing Acceptance tests are done primarily by the users.


The goal of acceptance tests is to confirm that the system is complete, meets the
business needs, and is acceptable to the users.
Acceptance testing is done in two stages:
- Alpha testing - users test the system using made-up data
- Beta testing – users begin to use the system with real data and carefully monitor
the system for errors.

26. Describe system documentation, User documentation, system review,


system
Maintenance, system support?
Ans: There are two fundamentally different types of documentation:
- System documentation is intended to help programmers and systems analysts
understand the system and enable them to build it or maintain it;
- User documentation is designed to help the user operate the system. User
documentation should not be left until the end of the project. Time required to
develop and test user documentation should be built into project plan. On-line
documentation is becoming the predominant form.
-system review the focus of the system review is understanding the extent to
which the proposed costs and benefits were actually recognized from the
implemented system.
System review helps the organization improve in future projects.
-system maintenance System maintenance is the process of refining the system to
make sure it continues to meet business needs.
Change requests typically come from five sources:
- The most common source is problem reports from the operations group.
- Second: Enhancements to the system from users.
- Third: Other system develop project.
- Fourth: Underlying software or networks change.
- Fifth: Requests from senior management.
-system support once the new system has been installed, the system is officially
turned over to the operations group. Providing system support means helping the
users to use the system. This type of support can be thought of as on-demand
training.
-Online support is the most common form of on-demand training.
-A help desk provides a place for a user to talk.

Das könnte Ihnen auch gefallen