Sunday 13 December 2015

ADF Interview Questions - Set 1


Question: What is Oracle ADF?
Answer: Oracle ADF is a commercial Java/J2EE framework, which is used to build enterprise applications. It is one of the most comprehensive and advanced framework in market for J2EE.

Question: What are the advantages of using ADF?
Answer: Following are the advantages of using :
1. It supports Rapid Application Development.
2. It is based on MVC architecture
3. Declarative Approach (XML Driven)
4. Secure
5. Reduces maintenance cost and time
6. SOA Enabled

Question: What are various components in ADF?
Answer: Oracle ADF has following components:
1. ADF Business Components(Model): VO, EO & AM
2. ADF Faces (View): JSP, JSF, ADF Faces etc.
3. ADF Task flows (Controller): Task flows (adf-config.xml), faces-config.xml

Question: Which component in ADF BC manages transaction?
Answer: Application Module in ADF BC manages transaction.

Question: Can an entity object be based on two Database Objects(tables/views) or two Webservices ?
Answer: No entity objects will always have one to one relationship with a database object or web service.

Question: Where is that we write business rules/validations in ADF and why?
Answer: We should be writing validations at Entity Object level, because they provide highest degree of reuse.

Question: What is a Taskflow?
Answer: Taskflow is the controller of an ADF application, it provides us a declarative approach to define the control flow.  It is used to define the navigation between pages and various taskflow activites.

Question: What are the different types/categories of Taskflows ?
Answer: Taskflows are of two categories : Bounded and UnBounded.

Question: What is the difference between Bounded and UnBounded taskflows?
Answer: Differences between Bounded and UnBounded taskflows :
1. Bounded taskflows can be secured but Unbounded can’t.
2. Bounded taskflows can accept parameter and return values but unbounded taskflows don’t support parameters
3. Bounded taskflows has a single entry point or a default activity but unbounded taskflows have multiple entry points.
4. Bounded taskflows can be called from other bounded/unbounded taskflows but unbounded cannot be called or reused.
5. Bounded taskflows support transactions unbounded don’t.

Question: What are different scope of ADF taskflow?
Answer: Isolate/Shared. Shared scope will share data among the multiple instance of taskflows while Isolated doesn't.

Question: How to initialize ADF Taskflow?
Answer: Open the taskflow in Overview Mode-> Select general -> In initiallizer property provide the any method reference which will get invoked whenever taskflow instance created.

Question: What is the Parent Action in ADF Taskflow?
Answer: Parent action is activity using that you can invoke the Control flow define in parent taskflow from child taskflow.

Question: What is method activity in Adf  Taskflow?
Answer: Using this activity you can invoke a method defined in managed-bean.

QuestionDifference between JSF Page Flow & ADF Task Flow
Answer: JSF Page Flow: 
1. The entire application must be represented in a single page navigation file (faces-config.xml). Although you can have multiple copies of faces-config.xml in a project, the application loads these files as one at runtime.
2. All nodes within a JSF page flow must be JSF pages. No other types of objects can exist within the JSF page flow.
3. Navigation is only between pages.
4. Application fragments cannot be reused.
5. There is no shared memory scope between multiple requests except for session scope.
ADF Task Flow: 
1. The application can be broken up into a series of modular flows that call one another.
2. You can add to the task flow diagram nodes such as views, method calls, and calls to other task flows.
3. Navigation is between pages as well as other activities, including routers.
4. ADF task flows are reusable within the same or an entirely different application.After you break up your application into task flows, you may decide to reuse task.
5. Shared memory scope (for example, page flow scope) enables data to be passed between activities within the task flow. Page flow scope defines a unique storage area for each instance of an ADF bounded task flow.

Question: How to develop reusable taskflow in ADF?
Answer: Please fins the step below
1. Define taskflow
2. Define deployment profile as ADF Library jar
3. Deploy ADF jar file
4. Open new project where you want to consume the task flow.
5. Add newly created jar of taskflow project 
6. Go to component pallete, you will find your jar name, select it.
7. It will show list of taskflow which you have developed.
8. Drag drop your taskflow as region on jsff/jspx page and run an application

Question: How can you force ADF taskflow to use new transaction everytime taskflow is called?
Answer: Go taskflow overview and you will find Share data controls with calling task flow option. Select always begin new transaction fron dropdown

Question: How to use same transaction in ADF taskflow?
Answer: Go taskflow overview and you will find Share data controls with calling task flow option. Select Always Use existing Transaction option.

Question: How can you pass parameter to ADF taskflow?
Answer: Go to Overview tab -> Select parameters link -> Add multiple parameters which you want to pass to taskflow while loading it.

Question: How can navigation defined in taskflow?
Answer: Navigation can be defined in taskflow using control flows and invoked by jsff/jspx page using action event like button link etc.

Question: Explain the purpose of using Controls flow in ADF?
Answer: Controls flow defined in taskflow can be called anytime from any page of that taskflow. If you have same flow for multiple pages just define the control flow once in taskflow. You can invoke it anytime from any action event.

Question: What is the behavior of router in ADF taskflow?
Ans : Based on some condition router can decide which route need to be follow. If none of condition match in that case router will follow default route defined by used.

Question: Can ADF task flow hold more than 1 view activity?
Answer: ADF taskflow can have multiple view activity but 1 activity has to be defined as default activity. 

Question: What is the Parent Action Activity in ADF Taskflow?
Answer: Parent action activity using it you can invoke the Control flow define in parent taskflow from child taskflow. 
Used to create new task flow using existing task flow.

Question: How to initialize ADF Taskflow?
Answer: Open the taskflow in Overview Mode select General option, there is initiallizer property. 
you can provide the any method reference which will get invoked whenever taskflow instance created.

Question: How to convert an ADF bounded task flow to Unbounded Task Flow or Page Fragments?
Answer: In the editor, open the bounded task flow diagram. Right-click anywhere in the diagram other than on an activity or control flow. Choose a menu item such as Convert to Unbounded Task Flow or Convert to Task Flow with Page Fragments. 
If the bounded task flow contains fragments, the menu item will be Convert to Task Flow with Pages.

Question: How to use same value in multiple activities of a Task Flow?
Answer: 
1. Using Shared memory scope (for example, page flow scope) enables data to be passed between activities within the task flow. 
2. Page flow scope defines a unique storage area for each instance of an ADF bounded task flow. 
3. Any managed beans you decide to use within task-flow can be specified in page flow scope, so are isolated from the rest of the application

Question: How can one bounded task flow can call another?
Answer: One task flow can call another bounded task flow using a task flow call activity or a URL.

Question: If you want to show information to end users in a secondary browser, how will you show?
Answer: Use dialogs option from activities.

Wednesday 9 December 2015

SQL Interview Questions



Question: How will you delete duplicating rows from a base table?

Answer: 
DELETE FROM table_name A WHERE rowid > (SELECT MIN(rowid) FROM table_name B WHERE A.key_values = B.key_values);

DELETE FROM emp e WHERE ROWID NOT IN ( SELECT MIN(ROWID) FROM emp a WHERE e.empno = a.empno);

DELETE FROM EMP WHERE ROWID NOT IN (SELCT MAX(ROWID) FROM EMP GROUP BY EMPNO);


Question: Find out nth highest salary from emp table?
Answer: 
SELECT DISTINCT (A.SAL) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (B.SAL)) FROM EMP B WHERE A.SAL<=B.SAL);

SELECT MIN(SAL) FROM (SELECT DISTINCT SAL FROM EMP ORDER BY SAL DESC) WHERE ROWNUM <=&N;

SELECT * FROM (SELECT RANK() OVER (PARTITION BY SAL ORDER BY SAL DESC NULLS LAST) RN FROM TABLENAME) WHERE RN = &N;

SELECT ENAME, SAL, DEPTNO, JOB FROM EMP WHERE SAL=(SELECT MAX(SAL) FROM EMP WHERE LEVEL = &LEVELNO CONNECT BY PRIOR SAL>SAL GROUP BY LEVEL);

SELECT ROWNUM,SAL FROM (SELECT ROWNUM,SAL FROM EMP ORDER BY SAL DESC )GROUP BY ROWNUM,SAL HAVING ROWNUM=&N;

SELECT * FROM(SELECT EMPNO,ENAME,DEPTNO,SAL,RANK() OVER(ORDER BY SAL) TOPSAL FROM EMP) WHERE TOPSAL=&NTH;

SELECT DISTINCT A.SAL FROM EMP A, (SELECT ROWNUM AS CNT, A.* FROM (SELECT DISTINCT SAL FROM EMP ORDER BY SAL DESC) A) B WHERE A.SAL = B.SAL AND B.CNT = :A;

SELECT LEVEL,MAX(SAL) FROM EMP WHERE LEVEL=&LEVELNO CONNECT BY PRIOR SAL>SAL GROUP BY LEVEL;

Question: Which datatype is used for storing graphics and images?

Answer:  BLOB or BFILE. Long raw is obsolete now.


Question: Which is more faster - IN or EXISTS?

Answer: EXISTS is more faster than IN because EXISTS returns a Boolean value whereas IN returns a value.

In many cases, EXISTS is better because it requires you to specify a join condition, which can invoke an index scan. EXISTS is faster when sub-query result is large. IN is often better if the result of sub-query are very small. But using EXISTS is better choice when sub-query result is unpredictable.