Monday, August 16, 2021

Adv. Java

 1.Define the following terms:Purchase OrderDelivery ChallanRejection NoteGoods Received NoteGoods Inwards Note

Ans:
i)Purchase Order - A document from the customer to the seller listing the required items and providing a description of the goods.
ii)Delivery Challan - A document that is sent with the shipment of goods. It lists the description, and quantity of the goods that are delivered.
iii)Rejection Note - A document that lists the materials that are rejected due to defects found during quality inspection. The reason of rejection is also included.
iv)Goods Received Note - A document that acknowledges that the materials have been inspected and accepted by the manufacturer.
v)Goods Inwards Note - A document that records the entries of the materials when they are received at the store of the organization.

2.Identify the various criteria for classifying an organization and discuss them in detail.
Ans:
An organization consists of a group of people working specifically to achieve a common goal. Organizations can be classified on the basis of nature of work, profitability, type of system, and ownership

i)Based on the Nature of Work:
Organizations can be classified depending on their nature of work as:

a)Manufacturing-based: Business organizations involved in producing tangible goods or products are called manufacturing organizations. b)Automobile manufacturing companies, iron and steel plants, and food and beverage processing units are examples of manufacturing organizations.
c)Service-based: Business organizations involved in providing services to other businesses or people, rather than producing tangible goods, are called service-based organizations. Airlines, hotels, hospitals, banks, and insurance agencies are examples of service organizations.
Based on Profitability:

ii)Organizations may be classified on the basis of their focus on profit. These organizations can be:

a)Profit-based organizations: The primary goal of these organizations is to increase their profit margin. These organizations try to increase the value of their share by increasing the value of the company stock.
b)Nonprofit-based organizations: These organizations do not have profit as their primary goal. They are usually involved with socially relevant issues. Some examples of nonprofit organizations include social groups, universities, human rights commissions, and worker unions.

iii)Based on the Type of System:
Based on the type of system an organization implements, it can be classified as simple or complex and adaptive or nonadaptive.

a)Simple or complex: A simple system consists of a lesser number of elements that interact with each other in a simple and uncomplicated manner. An eating joint is an example of a simple system, wherein the customer places an order, the ordered food is prepared, and the food is served to the customer.  Components in a complex system have a high level of interaction with each other. A car manufacturing organization is an example of a complex system.
b)Adaptive or nonadaptive: An adaptive organization is one that is able to change in response to the changes in the environment. For example, the fashion and cosmetics industries are highly dependent on external stimuli. A nonadaptive organization is one that is not able to change easily in response to external stimuli. For example, the automobile industry needs to take many factors into account before deciding on a change. These factors may include the cost of manufacturing a modified product or the availability of raw materials.

iv)Based on Ownership:
On the basis of the nature of ownership, business organizations can be classified into the following types:

a)Sole proprietorship: When one individual heads a business organization, it is said to be sole proprietorship.
b)Partnership: A partnership organization has two or more individuals conducting the business together. Corporation: A corporation is a legal entity conducting business with numerous owners.

3.Explain the following terms briefly:
Test case
Collaboration
Generalization
Job shops
Batch processing
Ans:
i)Test case: A test case is a set of actions that is executed to examine whether or not the implemented code of the software system complies with the requirements stated by the customer. This helps you to validate the system functionality against system requirements. A test case developed for a particular function of the software system includes a set of test input, execution conditions, and expected results.
ii)Collaboration: UML provides specific modeling constructs, known as collaborations, to model a use case realization in the design phase. Collaboration is a collection of classes, interfaces, and sub-systems that interact with each other to achieve the functions of a use case. It can be represented by creating an oval with a dotted line.
iii)Generalization: The generalization relationship exists among the actors or use cases that have similar behavior and properties. Two actors or use cases are said to have a generalization relationship when the characteristics of one actor or use case can be derived from the characteristics of another actor or use case.
iv)Job shops: The Job shop production process involves the manufacturing of a wide variety of products in small numbers for a specific customer requirement. This production process is used to make a higher number of products as compared to projects. Job shops require general-purpose equipment that is flexible, because every product goes through a different sequence of processes. In job shops, resources are sometimes overloaded, while at other times, they may be idle. Examples of a job shop include manufacturing of special items, such as furniture.
v)Batch processing: The batch processing production process involves large-scale manufacturing of products on the same equipment. Every new product incurs additional setup costs that can be reduced by manufacturing more units in each cycle. Products are stocked and supplied based on customer demand. Batch processing caters to those products that are generic in nature. Therefore, general-purpose equipment is used. The process does not undergo many changes, but skilled workers are required to perform tasks. Examples of batch processing include book publishing, garment manufacturing, and pharmaceutical production.

4.Describe the class diagram and class notations used in UML. Explain the visibility of attributes and operations in a class diagram. Explain the syntax of attributes and operations in class diagrams.
Ans:
Class diagram and class notations used in UML

A class diagram is used to create a structural model of a software system. The structural model describes the static architecture of a system and helps the software developer to translate the system use cases into system design.

 UML provides a class notation to represent classes in class diagrams. The class notation has three compartments where the first compartment depicts the name of the class, the second compartment depicts the attributes of the class, and the third compartment depicts the operations of the class.You can use class notations to document the design of a system in accordance with the requirements identified during the requirements analysis phase.
Visibility of attributes and operations

It is vital to ensure that the data of your classes remain secure. For this, UML allows you to specify the visibility of the class attributes and operations, which controls the accessibility of these class members from other classes. UML provides the following four visibilities for the attributes and operations of a class:

i)+: Indicates that the attribute or operation is accessible to other classes. In other words, the attribute or operation is public.
ii)-: Indicates that the attribute or operation is inaccessible to other classes. In other words, the attribute or operation is private.
iii)#: Indicates that the attribute or operation in the base class is accessible to derived classes. In other words, the attribute or operation is protected.
iv)~: Indicates that the attribute or operation is accessible to the classes, which are within the same package.
Syntax of attributes in class diagrams

The attributes of a class follow certain syntax in the class diagrams. The syntax to depict an attribute in a class diagram is:

visibility name: type

The preceding syntax contains the following mandatory fields:

i)visibility: Specifies whether the attribute of the class is private, public, protected, or package.
ii)name: Indicates the name of the attribute. This is a mandatory field.
iii)type: This is an optional field. It specifies the data type of the attribute.
For example, the Name attribute of the Employee class can be represented as:

-Name: String

Syntax of operations in class diagrams

The syntax to represent an operation of a class in the class diagrams is:

visibility name (parameter-list): return-type

The preceding syntax contains the following fields:

i)visibility: Specifies whether the operation of the class is private, public, protected, or package.
ii)name: Indicates the name of the operation.
iii)parameter-list: Indicates the list of parameters for the operat.
iv)return-type: Represents the data type of the value returned by the operation. This field can take the null value when the operation does not return any value.
The parameters of an operation are denoted using the following syntax:

Parameter name: type

For example, the getName() operation of the Employee class can be represented as:

+getName(EmpId : int) : string

5.What is meant by logistics? Explain the activities involved in logistics planning (any two) in detail.
Ans:
Logistics is a business-planning framework. It involves planning for the movement and storage of materials and information from any point in the operational process to the final order-fulfillment stage. Organizations thrive on the effectiveness and efficiency of their operational strategies. An efficient logistics plan supports in implementing the organizational processes, such as production and sales and marketing, effectively.

Logistics planning involves the following activities:

Analyzing the core business processes

Analysis of the core business processes of an organization is important as the logistics activities differ depending on the nature of the business undertaken by an organization.

Some of the general processes for a typical manufacturing-based business organization include:

i)Purchasing of material
ii)Receiving the material
iii)Warehousing
iv)Controlling the inventory
v)Handling the material
vi)Shipping
vii)Making decisions for physical distribution

The distribution of products is an important activity for an organization and its customers. For example, in a manufacturing organization, the goods are typically moved from the Production department to the warehouses, where they are stored until they are sent to the dealers.
The main factors to be considered while making decisions for the physical distribution are:

The size, number, and location of warehouses
The mode of transport depending on the type of goods, distances, and weights
The work force to be employed or hired.
Deciding the location of facilities:

Whenever an organization wants a new factory, warehouse, shop, office or other facilities, it is important to identify a strategic location.

Most organizations evaluate the feasibility of the location of a facility, such as a production plant, based on the factors, such as:

i)The locations of competitors, suppliers, and customers
ii)Availability of skilled workforce in the area
iii)Costs pertaining to operations, wages, transport, and taxes
iv)Transport and services availability
v)Plans regarding future expansion, or globalization

6.What is a state machine diagram? Explain its various components.
Ans:
Before developing a software system, a developer must understand the various states through which a component goes from its creation to termination. For this, UML provides a state machine diagram. A state machine diagram represents the various states that an object goes through during its lifecycle in response to events. You need to model the behavioral aspects of a system by using state diagrams. Therefore, you create a state diagram for the objects that respond to events. The various constituents of a state diagram are states, events, and transitions.

i)A state depicts a condition of an object and the activities of an object during its lifecycle. An initial state is the starting state of an object and is represented as a dot. A final state is the end state of an object and is represented as a dot encircled by a ring.
ii)An event is an occurrence that triggers a change of state of an object. It signifies the receipt of a message that requests for an operation to be performed.
iii)A transition is a change of state of an object due to the occurrence of an event. For example, the state of customer complaint transitions from Open to Closed when the Complaint Resolved on Phone event occurs. Similarly, the state transitions from Open to Waiting when the Complaint Not Resolved on Phone event occurs and from Waiting to Closed when the Complaint Resolved Onsite event occurs.

7.What is a product? Explain the product life cycle in detail.
Ans:
A product is an article or a substance that is manufactured or produced by a company for sale. The main objective of a product is to make the customer feel satisfied or benefited after the purchase of the product. Before marketing a product, it is important to understand the life cycle of a product in the market. When a product is launched, the demand for it varies with time. There are different stages through which the product passes when it is introduced in the market. These stages comprise the product life cycle. The life cycle of a product starts when it is launched in the market till the time it remains in the market. This life cycle helps organizations in analyzing the product's impact on the organization's market share. The different stages of a product life cycle are: introduction, growth, maturity, and decline.

i)Introduction: This is the first stage when the product is introduced in the market. The main focus of the organization at this stage is to make the customer aware of the product and its benefits. For this, organizations invest more in advertising and other promotional strategies. The focus is not on revenue generation.
ii)Growth: At the growth stage, once the product is established in the market, more retailers and customers are attracted to it. At this stage, the organization maintains the quality and price of the product to attract more customers. This results in profits for the organization.
iii)Maturity: At the maturity stage, the sale of the product first reaches saturation in the market. The distribution of the product reaches to the fullest in the market, leaving minimum demand for the product. Thereafter, its sale starts declining. The primary goals of an organization at this stage are to maintain the market share and promote the product by differentiating it from competitors? product.
iv)Decline: At the decline stage, there is a rapid increase of competing products that may be better in quality and low in price. As a result, sales start declining and production volumes need to be reduced. The primary goal of an organization at this stage is to try maintaining the sale of the product by adding new features and reducing the cost. However, if the product is still incurring loss, the organization may discontinue the product.

8.What is meant by logistics? Explain the activities involved in logistics planning (any two) in detail.
Ans:
Logistics is a business-planning framework. It involves planning for the movement and storage of materials and information from any point in the operational process to the final order-fulfillment stage. Organizations thrive on the effectiveness and efficiency of their operational strategies. An efficient logistics plan supports in implementing the organizational processes, such as production and sales and marketing, effectively.

Logistics planning involves the following activities:

i)Analyzing the core business processes

ii)Analysis of the core business processes of an organization is important as the logistics activities differ depending on the nature of the business undertaken by an organization.

Some of the general processes for a typical manufacturing-based business organization include:

i)Purchasing of material
ii)Receiving the material
iii)Warehousing
iv)Controlling the inventory
v)Handling the material
vi)Shipping
vii)Making decisions for physical distribution

The distribution of products is an important activity for an organization and its customers. For example, in a manufacturing organization, the goods are typically moved from the Production department to the warehouses, where they are stored until they are sent to the dealers.
The main factors to be considered while making decisions for the physical distribution are:

i)The size, number, and location of warehouses
ii)The mode of transport depending on the type of goods, distances, and weights
iii)The work force to be employed or hired.
Deciding the location of facilities:

Whenever an organization wants a new factory, warehouse, shop, office or other facilities, it is important to identify a strategic location.

Most organizations evaluate the feasibility of the location of a facility, such as a production plant, based on the factors, such as:

i)The locations of competitors, suppliers, and customers
ii)Availability of skilled workforce in the area
iii)Costs pertaining to operations, wages, transport, and taxes
iv)Transport and services availability
v)Plans regarding future expansion, or globalization

9.Explain the various stages of marketing process.
Ans:
The stages of the marketing process are analyzing the need for a product, deciding upon the marketing strategy, implementing the marketing strategy, and monitoring the product.

i)Analyzing the need for a product: While analyzing the need for a product, organizations need to analyze the customer's requirements and its own capabilities to manufacture a product. While planning for the marketing strategy for a product, an organization must analyze whether it has sufficient funds to be able to manufacture and get sufficient returns.
ii)Deciding upon the marketing strategy: After the analysis of the customer requirements and market trends, an organization needs to decide upon its marketing strategy. This strategy requires a decision on the marketing mix as well as a target market for which the marketing mix is prepared. The marketing mix consists of variables that marketing managers can control in order to best satisfy customers in the target market.
iii)Implementing a marketing strategy: The plan prepared at the decision stage of the marketing process is implemented at this stage. The product is launched in the market and the planned promotional strategies are implemented to ensure customer awareness and sale of the product. The launch of a product includes the following activities:
a)Product performance is evaluated through tests and quality checks.
b)Final packaging is designed and ordered.
c)Sales channels are identified and established.
d)Product feedback is updated based on market feedback and analysis.
e)Product documentation is completed and finalized.
f)User documentation, operating manuals, advertisement materials, product brochures, marketing materials, press releases, website pages, and maintenance instructions are completed and ready to be distributed at the appropriate time.
g)A Production Readiness Review document is prepared. This document confirms that all preparations are completed and the product is ready for launch.
h)The new product is launched when the service, sales, and distribution channels are ready.
iv)Monitoring the product: The task of the marketing team does not get over with the launch of the product in the market. At this stage, an organization needs to collect regular feedback from customers regarding their likes, dislikes, and suggestions for improvement of the product.  At this stage, competitors and their similar products need to be monitored closely and the marketing strategy may need to be modified accordingly.

10.What is structural modeling? List any three UML diagrams for structural modeling and explain them briefly.
AnsUML provides various modeling techniques to represent the framework of a software system. Each modeling technique contains a set of diagrams to represent the requirements and structure of the software system. The UML modeling techniques may be used for structural modeling and behavioral modeling. Structural modeling involves depicting the static features of the software system. It is used to represent how the components or elements exist in a system.

The various UML diagram for structural modeling are:

i)Class diagram: A class diagram represents a set of classes, interfaces, and their relationships. It describes the set of attributes and operations associated with each class and the relationships among the various classes.
ii)Object diagram: An object diagram represents an instance of a class diagram. It represents the properties of a particular instance of a class.
iii)Package diagram: A package diagram represents the interrelated classes and interfaces of the system in a package.  It helps in representing the various packages of a software system and the dependencies between them. It also gives a high-level impression of use case and class diagrams.
iv)Component diagram: A Component diagram combines packages or individual entities to form components. You can depict these components and their dependencies by using a component diagram.
v)Deployment diagram: A deployment diagram shows the physical placement of components in nodes over a network. A deployment diagram can be drawn by identifying nodes and components.

11.Explain the concept of production planning in brief. Discuss in detail about the MRP phase of production planning.
Ans:
Production planning is an integral part of the production process. It is the first step in the production process. Every manufacturing-based organization performs a set of operations for producing finished goods. Each operation in the production process of an organization must be systematically designed, planned, organized, and controlled.

Production planning:

i)Helps organizations to develop and implement strategies so that cost-effective goods are produced with minimum resources.
ii)Involves the systematic scheduling of workers, materials, and machines for manufacturing products efficiently, economically, and timely.

The different phases of production planning are:
1. Material requirement planning (MRP)
2. Selecting the production process

MRP is an inventory control process used to calculate the amount of raw materials required to manufacture a specific product. MRP involves reviewing the stock quantity of raw materials according to the quantity of products to be manufactured in a specific period. It then involves calculating the quantity of components and materials required to manufacture those items and identifying the supply of materials required for the scheduled production. MRP involves planning work orders and purchase requisitions and suggesting appropriate rescheduling of the current material plan by taking into account the actual delivery date of a product.
The main inputs of MRP are:
i)Master Production Schedule (MPS) shows the quantity of products to be manufactured in a specific period. It is a detailed manufacturing plan that determines the products a manufacturer has to produce within predefined timelines. During MRP, the estimated plan provided by MPS is translated into a detailed plan that specifies the schedule for material requirement and delivery.
ii)Bill of Materials (BOM) consists of the materials, parts, and components that are required to manufacture the product. During MRP, the BOM and MPS are used to calculate the amount of each material required.
The lead-time is the time between the placement of an order for a product and the actual date of delivery. Determining lead-time of raw materials is essential for a manufacturing company so that the finished goods can be delivered to the customer in a timely manner and any shortages can be handled before the production process starts.
iii)Inventory records provide a detailed list of all the items that are currently in stock. The information is stored in a tabular format. MRP uses these existing inventory records to calculate the net quantity of materials required from the supplier. The net quantity required is calculated by subtracting the existing inventory from the total materials required as per MPS.
The main outputs of MRP are:
i)Schedule for Orders: It provides guidelines to place an order depending on the lead-time.
ii)Purchase Orders: It is a buyer's document and is used to formalize a purchase transaction with a supplier. On acceptance by the supplier, it becomes a legally binding contract between the two parties and hence, it must specify all terms and conditions applicable to the contract.
iii)Reports: The information from MRP is processed to generate various reports, such as performance reports and inventory transactions.

Java

 Core Java Subjective Question

1.Identify the features of New API (NIO).
Ans:
i)The new API works more consistently across platforms.
ii)It makes it easier to write programs that gracefully handle the failure of file system operations.
iii)It provides more efficient access to a larger set of file attributes.

2.Differentiate between checked and unchecked exceptions.
Ans:
Checked Exception:
i)Every class that is a subclass of Exception except RuntimeException and its subclasses falls into the category of checked exceptions.
ii)You must ?handle or declare? these exceptions with a try or throws statement.

Unchecked Exception:
i)java.lang.RuntimeException and java.lang.Error and their subclasses are categorized as unchecked exceptions.
ii)You may use a try-catch statement to help discover the source of these exceptions, but when an application is ready for production use, there should be little code remaining that deals with RuntimeException and its subclasses.

3.Explain public, static, and void keywords in the following statement:
public static void main(String args[])
Ans:
i)public: The public keyword indicates that the method can be accessed from anyobject in a Java program.
ii)static: The static keyword is used with the main() method that associates the method with its class. You need not create an object of the class to call the main() method.
iii)void: The void keyword signifies that the main() method returns no value.

4.Identify the limitations of the java.io.File class.
Ans:
The java.io.File class has the following limitations:
i)Many methods did not throw exceptions when they failed, so it was impossible to obtain useful error messages.
ii)Several operations were missing (file copy, move, and so on).
iii)The rename method did not work consistently across platforms.
iv)There was no real support for symbolic links.
v)More support for metadata was desired, such as file permissions, file owner, and other security attributes.
vi)Accessing file metadata was inefficient?every call for metadata resulted in a system call, which made the operations very inefficient.
vii)Many of the File methods did not scale. Requesting a large directory listing on a server could result in a hang.
viii)It was not possible to write reliable code that could recursively walk a file tree and respond appropriately if there were circular symbolic links.

5.Identify the five classes of the java.util.concurrent package and explain any two classes.
Ans:
i)Semaphore: Is a classic concurrency tool.
ii)CountDownLatch: A very simple yet very common utility for blocking until a given number of signals, events, or conditions hold.
iii)CyclicBarrier: A resettable multiway synchronization point useful in some styles of parallel programming.
iv)Phaser: Provides a more flexible form of barrier that may be used to control phased computation among multiple threads.
v)Exchanger: Allows two threads to exchange objects at a rendezvous point, and is useful in several pipeline designs.

6.Steve has been asked to automate the Library Management System either in C++ or Java. Steve has chosen to develop the project in Java. Identify the reason.
Ans:
One of the major problem areas in most of the object-oriented languages, such as C++, is to handle memory allocation. Programmers need to explicitly handle memory in the program for its optimum utilization. To handle memory allocation, they use pointers that enable a program to refer to memory location of the computer. However, Java does not support pointers and consists of the built-in functionality to manage memory.

7.You have created a class with two instance variables.You need to initialize the variables automatically when a class is initialized. Identify the method that you will use you to achieve this. In addition, describe the characteristics of this method.
Ans:
You can initialize the variable by using the constructor. The characteristics of a constructor are:
-       A constructor has the same name as the class itself.
-       There is no return type for a constructor. A constructor returns the instance of the class instead of a value.
-        A constructor is used to assign values to the data members of each objectcreated from a class

8.Differentiate between interface and abstract class.
Ans:
1.The methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior.
2.Variables declared in a Java interface are by default final. An abstract class may contain non-final variables.
3.Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like private, protected, etc..
4.Java interface should be implemented using keyword, implements; A Java abstract class should be extended using keyword, extends.
5.An interface can extend another Java interface only, an abstract class can extend another Java class and implement multiple Java interfaces.
6.A Java class can implement multiple interfaces but it can extend only one abstract class.
7.Interface is absolutely abstract and cannot be instantiated; A Java abstract class also cannot be instantiated, but can be invoked if a main() exists.
8.In comparison with Java abstract classes, Java interfaces are slow as it requires extra indirection.