If you're looking for Drools Interview Questions for Experienced or Freshers, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research Drools has a market share of about 1.7%. So, You still have opportunity to move ahead in your career in Drools Development. Mindmajix offers Advanced Drools Interview Questions 2019 that helps you in cracking your interview & acquire dream career as Drools Developer.

Are you interested in taking up for Drools Certification Training? Enroll for Free Demo on Drools Training!

Top 40 Drools Interview Questions

1Q. What is Drool?

Ans: Drools is the Business Rule Management System (BRMS) provided by the JBoss Community for implementing complex applications with automatic behaviors based on rules. The framework is essentially based on an extension of the Rete pattern-matching algorithm.

2Q. What are the features of JBoss Enterprise Web Platform?

Ans: The JBoss Enterprise Web Platform is the software infrastructure that supports the running of BRMS components.

3Q. What is MVEL Dialect?

Ans: MVEL is an expression language for Java-based applications. It supports field and method/getter access. It is based on Java syntax.

4Q. Why use Drools and not other programming languages?

Ans: The rules logic can be done in a programming language like Java .Consider a Jewellery shop which needs to maintain business logic of calculating discount based on the type of Jewellery. But such rules may change daily and need to be updated regularly in our code which is not good. Also we will always require a Developer for making such changes. So its a good practice to define this logic as rules in a Business Rule Management System. If tomorrow the discount is to be changed this can be done even by a non technical person.

5Q. JBoss Enterprise BRMS

Ans: 

JBoss Enterprise BRMS is a business rule management system and reasoning engine for business policy and rules development, access, and change management. JBoss Enterprise BRMS is a productized version of Drools with enterprise-level support available. JBoss Rules is also a productized version of Drools, but JBoss Enterprise BRMS is the flagship product.

Components of the enterprise version:

1. JBoss Enterprise Web Platform – the software infrastructure, supported to run the BRMS components only

2. JBoss Enterprise Application Platform or JBoss Enterprise SOA Platform – the software infrastructure, supported to run the BRMS components only

Subscribe to our youtube channel to get new updates..!

Business Rules Engine – Drools Expert using the Rete algorithm and the Drools Rule Language (DRL)

3. Business Rules Manager – Drools Guvnor – Guvnor is a centralised repository for Drools Knowledge Bases, with rich web based GUIs, editors, and tools to aid in the management of large numbers of rules.

4. Business Rules Repository – Drools Guvnor

Drools and Guvnor are JBoss Community open source projects. As they are mature, they are brought into the enterprise-ready product JBoss Enterprise BRMS.

Components of the JBoss Community version:

1. Drools Guvnor (Business Rules Manager) – a centralized repository for Drools Knowledge Bases

2. Drools Expert (rule engine) – uses the rules to perform reasoning

3. Drools Flow (process/workflow), or jBPM 5 – provides for workflow and business processes

4. Drools Fusion (event processing/temporal reasoning) – provides for complex event processing

5. Drools Planner/OptaPlanner (automated planning) – optimizes automated planning, including NP-hard planning problems

Example

This example illustrates a simple rule to print out information about a holiday in July. It checks a condition on an instance of the Holiday class, and executes Java code if that condition is true.

rule "validate holiday"
dialect "mvel"
dialect "java"
when
    $h1 : Holiday( month == "july" )
then
    System.out.println($h1.name + ":" + $h1.month);
end

The purpose of dialect “mvel” is to point the Getter and Setters of the variables of your Plain Old Java Object (POJO) classes. Consider the above example, in which a Holiday class is used and inside the circular brackets (parentheses) “month” is used. So with the help dialect “mvel” the getter and setters of the variable “month” can be accessed.

Dialect “java” is used to help us write our Java code in our rules. There is one restriction or characteristic on this. We cannot use Java code inside “when” part of the rule but we can use Java code in “then” part.

Subscribe to our youtube channel to get new updates..!

We can also declare a Reference variable $h1 without the $ symbol. There is no restriction on this. The main purpose of putting the $ symbol before the variable is to mark the difference between variables of POJO classes and Rules.

User cannot use Java code inside “when” part of the rules. However, it can be use in the “then” part.

6Q. What is a Rule?

Ans: Rules are pieces of knowledge often expressed as, “When some conditions occur, then do some tasks.”

When

Then  

The most important part of a Rule is its when part. If the when part is satisfied, the then part is triggered.

rule             

      when     

      then      

end

7Q. What are Drool Workbench, Expert, and Fusion?

Ans: Drools Workbench is the web user interface for authoring and management. Drools Expert is the business rule engine and Drools Fusion is the complex event processing feature.

8Q. What is meant by accumulate in DRL Drools?

Ans: Accumulate is conditional element that was introduced in Drools version 4.0. It is used to iterate over the list of objects and help validation of data in Java operation.

Ex. accumulate (Counter() ; $cnt : count())

9Q. What is meant by KIE?

Ans: KIE stands for Knowledge is everything. It stands for Knowledge is everything. From Drools 6.0 onwards a new approach is used to create a Knowledge Base and a Knowledge Session. Knowledge base is an interface that manages a set of rules and processes. The main task of the knowledge base is to store and re-use rules because creation of rules is very expensive.Rules are contained inside the package org.drools.KnowledgeBase. These are commonly referred to as knowledge definitions or knowledge. Knowledge base provides methods for creating a Session.

10Q. What is the productized version of Drools?

Ans: JBoss Enterprise BRMS is the productized version of Drools and it has enterprise level support.

11Q. What is Knowledge Session?

Ans: The knowledge session is retrieved from the knowledge base. It is the main interface for interacting with the Drools Engine. The knowledge session can be of two types:

1. Stateless Knowledge Session

2. Stateful Knowledge Session

12Q. How to remove object from knowledge session?

Ans: Using retract method to remove the object from knowledge session can help.

13Q. What is the global variable in Drools?

Ans: The global variable in Drools is the keyword. Global is the variable used in Drool and is visible in all rules inside the DRL file.

14Q.What is the other nomenclature for Drool?

Ans: Drool is also called a production rule system that uses an enhanced implementation of the Rete algorithm. 

15Q.What is the standard supported by drool?

Ans: Drool supports enterprise framework for enforcement, construction and maintenance for business policies along with JSR-94 standards for the business rule engine. 

16Q.What are the components of jBoss Enterprise version?

Ans: jBoss enterprise version has the following components - JBoss Enterprise application of SOA platform, Business Rules Engine,   JBoss Enterprise web platform, and Business Rules Manager.

17Q.What are the features of JBoss Enterprise Application Platform?

Ans: Some important features of JBoss Enterprise Application Platform are as follows -  

  • Eclipse-based IDE is available using JBoss developer studio
  • java persistence using hibernate 
  • Supports Java EE and web services standards
  • Object request broker using JacORB for interoperability with CORBA objects. 

18Q.What is Drool flow?

Ans: Drool flow provides workflow capabilities to the drool platform. Workflow describes the order of steps that need to be executed. Drool flow allows users to execute and monitor their business logic.

19Q.What are the decision tables?

Ans:  In drools, decision tables are the excel-based tables. The logic in these tables can be understood and changed by the non-technical person. As the .drl file is difficult to manage, therefore, decision table is a good option which can be easily managed by non-programmers.

20Q.What do you understand by Drools stateful Vs Stateless knowledge session?

Ans: 

Stateless Session

Any changes in the facts while executing rules is not made aware to the rule engine.

dispose() method is called automatically to release the session.

Any changes in the facts while executing rules is not made aware to the rule engine so if any rule is modified no other re-activation of rules will take place. 

Stateful Session

Any changes in the facts while executing rules is made aware of the rule engine.

dispose() method should be called to release the session to avoid memory leaks.

As any changes in facts is available to the rule engine so if a rule is modified for a particular fact, this change will re-activate all the rules and fire the rules that are built on modified fact.

21Q.How do we implement backward chaining in Drools?

Ans: In background chaining, the first user takes a decision and then checks whether the decision is true or not by tracking the sequence of events. It is also referred to as derivation queries and drools implements that through query construct.

22Q.Which Drools attribute have you used?

Ans: There are following attributes used in Drools -

  • Salience - Drools used salience in order to figure out which drool to fire first 
  • No-loop  - Indefinite looping is avoided by using no-loop attribute 
  • Update statement - The update statements let the rules engine if any fact is modified. 

23Q.List out different execution control statements used in drools?

Ans: 

agenda-group - This is an optional keyword. If rule is not assigned to any agenda group, by default it belongs to the main agenda.

activation-group - It is a reserved keyword in drl file. Both single rule or multiple rules can belong to a particular activation-group.

ruleflow-group - It behaves very similar to agenda-group, it is primarily used for rules used in jBPM process flows.

24Q.Have you ever integrated Drools with other frameworks?

Ans: Yes, I have used Drools with Spring Framework.

25Q.How is Drool different from other programming languages?

Ans: Unlike other programming languages, Drool offers several modifications to be applied on coding and do not work on a certain set of patterns. Conventional programming languages do not provide any management solution for businesses which is the main feature of Drool.

26Q.What are the benefits of using rule engines in business project management?

Ans: Following are the advantages of using rule engines in a business project management -

  • High flexibility - Knowledgebase lets you adjust effectively about your choices when they are evolving.
  • Easy to learn - Rules are very easy to understand as compared to procedural code. 
  • Reduced intricacy - Rules handle expanding multifaceted nature as they utilize predictable business rules
  • Reusability - Business rules can be reused 

27Q.What do you understand about Drools process?

Ans: Drool process is a framework that provides a flow of work along with various business processes.

28Q.Why do we use the symbol "$" before every variable?

Ans: In Drools, we use "$" before every variable to ensure that there is no difference between POJO class and variables of rules.

29Q.What is Drool planner?

Ans: Drool planner is also called automated planning that optimizes the process during NP-hard planning issues.

30Q.What does JBPM do?

Ans:  JBPM is a light-weight workflow engine written in Java and allows you to execute business processes with the latest BPMN 2.0 specification. It runs on any Java environment you have as an application or service.

31Q.What is global in a DRL file?

Ans: Global is a keyword used while defining any variable which would be visible to all the rules in a DRL file. A global variable can be used with any type of object. Global must be used very carefully with the DRL file because any changes in the global variable are not notified to the working memory. 

32Q.Differentiate between StringBuffer class and StringBuilder class?

Ans: 

StringBuffer StringBuilder
StringBuffer is synchronized ie. two threads can’t call the method at the same time StringBuilder is unsynchronized ie. two threads can call the method at the same time
Less efficient as compared to StringBuilder Better than StringBuffer

33Q.Which tool is used to manage complex event processing in Drools?

Ans: Drool fusion is used for event processing and temporal reasoning. 

34Q.What is the use of dialect in Drools?

Ans: Dialect is used to write Java code in the rules and  points to the Getter and Setters of the variables of POJO (plain old Java objects) 

35Q.Can we use round trips between rules modified in Guvnor, load in the UI, modify and upload to Guvnor?

Ans: There is no such way to ensure this. Newcomers should not at all try this to avoid complications.

36Q.Can we work with a custom UI instead of using the Guvnor Rule?

Ans: It is possible to store the rules in the custom domain model in the database and generate the DRL from the same model. This helps render the Guvnor redundant in the custom environment.

37Q.What is the restriction in Java code?

Ans: A user cannot use Java code inside “when” part of the rules. However, it can be used in the “then” part.

38Q.Explain Drool Workbench, Expert, and Fusion?

Ans: Drools Workbench is the web user interface for authoring and management. Drools Expert is the business rule engine and Drools Fusion is the complex event processing feature.

39Q.How to halt the process in a DRL file?

Ans: User has to resort to drools.halt() in the consequence (then) part of the application.

40Q.How to remove the object from the knowledge session?

Ans: By using the retract method, we can remove the object from the knowledge session.

41Q.How to fetch and play with the rules in java code?

Ans: Rules do not exist as the Java codes. Use the Guvnor REST API to download the DRL source code for the rules and thereafter upload them all over again.

Explore Drools Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!