Apr 20, 2014

File System Object in UFT

File System Object in UFT
------------------------
    What is computer File System?

It is a feature Operating System used to work with Drives, Folders and Files
---------------------------------------------------
    Give some examples for File System Operations

Create a Folder

Copy a Folder

Delete a Folder

Create a Text File

Copy a Text File

Delete a Text File

Read data

Write data

Compare data

Search operations

etc....
----------------------------------
    How end user performs File System Operations
End user performs File System Operations manually with the help of Input devices.

----------------------------------------------------
    How to perform automatic File System Operations using VBScript
Using File System Object we can perform automatic File System Operations
--------------------------------------------------------

Create an Automation Object

Set Variable = CreateObject("Class Value")

Set - VBScript Statement

CreateObject - Built in Function
------------------------------------------------

("Scripting.FileSystemObject")

-------------------------------------------
Examples:
----------
'Create a Folder
Dim objFso
Set objFso = CreateObject("Scripting.FileSystemObject")
objFso.CreateFolder "C:\Documents and Settings\gcreddy\Desktop\QTP"
Set objFso = Nothing 'To release the memory
----------------------------------------------
'Check the existence of QTP Folder, if not exists then Create the Folder

Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\gcreddy\Desktop\QTP"
Set objFso = CreateObject("Scripting.FileSystemObject")

If Not objFso.FolderExists(FolderPath) Then
    objFso.CreateFolder FolderPath
End If

Set objFso = Nothing
----------------------------------------------
'Copy a Folder

Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\gcreddy\Desktop\QTP"
Set objFso = CreateObject("Scripting.FileSystemObject")
objFso.CopyFolder FolderPath, "C:\UFT"

Set objFso = Nothing
----------------------------------------------
'Delete a Folder

Dim objFso, FolderPath
FolderPath = "C:\Documents and Settings\gcreddy\Desktop\QTP"
Set objFso = CreateObject("Scripting.FileSystemObject")
objFso.DeleteFolder FolderPath

Set objFso = Nothing
---------------------------------------------------
'Check the existence of QTP folder, If exists then Delete the Folder

Dim ObjFso, FolderPath
FolderPath = "C:\Documents and Settings\gcreddy\Desktop\QTP"
Set ObjFso = CreateObject ("Scripting.FileSystemObject")

If ObjFso.FolderExists (FolderPath)Then
    ObjFso.DeleteFolder (FolderPath)
End If
Set ObjFso = Nothing
---------------------------------------------------
'Create a Text File
Dim ObjFso
Set ObjFso = CreateObject ("Scripting.FileSystemObject")
ObjFso.CreateTextFile "C:\Documents and Settings\gcreddy\Desktop\QTP.txt"

ObjFso.CreateTextFile "C:\Documents and Settings\gcreddy\Desktop\QTP.doc"

ObjFso.CreateTextFile "C:\Documents and Settings\gcreddy\Desktop\QTP.xls"

ObjFso.CreateTextFile "C:\Documents and Settings\gcreddy\Desktop\QTP.pdf"

Set ObjFso = Nothing
----------------------------------------------------------------------

Text stream Object

It is used to perform Text related Operations

Create Text stream Object

Set variable = FileSystemObject.CreateTextFile/OpenTextFile ("FilePath", File Mode)

File modes

1 for Read

2 for Write

8 for Append
------------------------
Text related Operations

Reading
    Read char by Char
    Line by Line
    Read All

Writing
    Write continuously
    Writ Line by Line
    Append

Comparison
    By Size (* External operation)
    By Text
    By Binary values

Search Operations
etc...
---------------------------------------------
'Read a Text file char by char
Dim objFso, objTextstream, myChar
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt")

Do Until objTextstream.AtEndOfStream
myChar=objTextstream.Read(1)
Msgbox myChar   
Loop
objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
----------------------------------------
'Read a Text file Line by Line
Dim objFso, objTextstream, myLine
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt")

Do Until objTextstream.AtEndOfStream
myLine=objTextstream.ReadLine
Msgbox myLine   
Loop
objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
----------------------------------------------
'Read a Text file (All)
Dim objFso, objTextstream, myContent
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\gcreddy\Desktop\UFT.txt")

myContent=objTextstream.ReadAll
Print myContent   

objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
-----------------------------------------------
'Read test data from a Text file and perform data driven testing for Login operation

Dim objFso, objTextstream, myLine, myField
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt")

objTextstream.SkipLine

While objTextstream.AtEndOfStream = False
myLine=objTextstream.ReadLine
myField = Split(myLine, ", ")

SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe","","C:\Program Files\HP\Unified Functional Testing\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set myField(0) Dialog("Login").WinEdit("Password:").Set myField(1)
wait 2
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Wend

objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
------------------------------------
'Read test data (7th Record)

Dim objFso, objTextstream, myLine, myField, LineCount
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt")

LineCount = 0
While objTextstream.AtEndOfStream = False
myLine=objTextstream.ReadLine
LineCount= LineCount + 1

If LineCount = 8 Then
myField = Split(myLine, ", ")

SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe","","C:\Program Files\HP\Unified Functional Testing\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set myField(0) Dialog("Login").WinEdit("Password:").Set myField(1) wait 2
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
End If
Wend

objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
-------------------------------------------
'Write data
Dim objFso, objTextstream, num1, num2, res
num1=10 : num2 = 20: res = num1 + num2

Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt", 2)

objTextstream.Write "Addition of num1, num2 is: "& res

objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
-------------------------------------------
'Write data
Dim objFso, objTextstream, num1, num2, res
num1=10 : num2 = 20: res = num1 + num2

Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.CreateTextFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt", 2)

objTextstream.Write "Addition of num1, num2 is: "& res

objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
-------------------------------------------
'Write data line by line
'Read link names from Rediff home page and export to a Text file
Dim objFso, objTextstream, oLink, Links, i

Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.CreateTextFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt", 2)
Set oLink = Description.Create
oLink("micclass").Value = "Link"

Set Links = Browser("Rediff.com - India, Business,").Page("Business Email | Company").ChildObjects(oLink)
objTextstream.WriteLine "Link Names"
objTextstream.WriteLine "---------------"


For i = 0 To Links.Count-1 Step 1
    objTextstream.WriteLine i+1 &") " & Links(i).GetRoProperty("text")
Next

objTextstream.Close
Set objTextstream = Nothing
Set objFso = Nothing
-----------------------------------------------
'Read Button Names fro Login Dialog and export to Text file

Dim objfso, objtextstream, obutton, buttons, i

Set objfso = Createobject ("Scripting.Filesystemobject")
Set objtextstream = objfso.OpenTextFile ("C:\Documents and Settings\gcreddy\Desktop\QTP.txt",2)

Set obutton = Description.Create
obutton("micclass").value = "Winbutton"

Set buttons = Dialog("Login").ChildObjects(obutton)

objtextstream.WriteLine "Button Names"
objtextstream.WriteLine "------------"

For i = 0 To buttons.count-1 Step 1
    objtextstream.WriteLine i+1 & ") " & buttons(i).getroproperty("text")
Next
objtextstream.Close
Set objtextstream = Nothing
Set objfso = Nothing
-------------------------------------
'Find a File Size

Dim objfso
Set objfso = Createobject ("Scripting.Filesystemobject")
Msgbox objfso.GetFile("C:\Documents and Settings\gcreddy\Desktop\QTP.txt").Size & " Bytes"
Set objfso = Nothing

Apr 15, 2014

Oracle Database Structure and Schema Interview Questions

Oracle Database Structure and Schema Interview Questions

1.What are the components of physical database structure of Oracle database?

Oracle database is comprised of three types of files. One or more datafiles, two are more redo log files, and one or more control files.

2.What are the components of logical database structure of Oracle database?

There are tablespaces and database's schema objects.

3.What is a tablespace?

A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to grouped related logical structures together.

4.What is SYSTEM tablespace and when is it created?

Every Oracle database contains a tablespace named SYSTEM, which is automatically created when the database is created. The SYSTEM tablespace always contains the data dictionary tables for the entire database.

5.Explain the relationship among database, tablespace and data file ?

Each databases logically divided into one or more tablespaces one or more data files are explicitly created for each tablespace.

6.What is schema?

A schema is collection of database objects of a user.

7.What are Schema Objects?

Schema objects are the logical structures that directly refer to the database's data. Schema objects include tables, views, sequences, synonyms, indexes, clusters, database triggers, procedures, functions packages and database links.

8.Can objects of the same schema reside in different tablespaces?

Yes.

9.Can a tablespace hold objects from different schemes?

Yes.

10.What is Partial Backup ?

A Partial Backup is any operating system backup short of a full backup, taken while the database is open or shut down.

11.What is Mirrored on-line Redo Log ?

A mirrored on-line redo log consists of copies of on-line redo log files physically located on separate disks, changes made to one member of the group are made to all members.

12.What is Full Backup ?

A full backup is an operating system backup of all data files, on-line redo log files and control file that constitute ORACLE database and the parameter.

13.Can a View based on another View ?

Yes.

14.Can a Tablespace hold objects from different Schemes ?

Yes.

15.What is the use of Control File ?

When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery.

16.Do View contain Data ?

Views do not contain or store data.

What are the Referential actions supported by FOREIGN KEY integrity constraint ?
UPDATE and DELETE Restrict - A referential integrity rule that disallows the update or deletion of referenced data. DELETE Cascade - When a referenced row is deleted all associated dependent rows are deleted.

17.What are the type of Synonyms?

There are two types of Synonyms Private and Public.

Apr 10, 2014

Triggers and Views in Oracle

Triggers and Views in Oracle

1.What is the trigger?Write syntax for triggers?

Triggers:
A Trigger is a PL/SQL block which is executed automatically basing on an event.
Triggering events are inserted, update, delete.
Trigger timing can be before, after, instead of
Syntax:
Create or replace trigger <TRIGGER_NAME><TIMMING><EVENT> ON <OBJECT_NAME>
Begin
-----------
-----------
-----------
END;

2.Different types of triggers.

Triggers are divided into two types
1. Statement level trigger
2. Row level trigger

*Statement level trigger:
These triggers are executed only once irrespective of number of rows affected by the event. By default every trigger is a statement level.

*Row level trigger:
These triggers are executed for every row which is affected by the event (multiple numbers of times). We can create a row level trigger by using “FOR EACH ROW” clause.

3.Why we are using triggers?

Triggers are used to enforce business rules.
We can enforce business rules by using :OLD and :NEW qualifiers.

ex:
*Query to see list of all the triggers:
Select object_Name from user_objects where object_TYPE = ‘Trigger’;

4.Abstract datatypes

Abstract datatypes:
Abstract data types are consists of one or more subtypes. Rather than being constrained to the standard oracle data types of number, date and varchar2 data types can more accurately describe your data.

Ex:
SQL>create type address_ty5 as object
                                     (street varchar(20),
                                        city varchar2(10),
                                             state char(10),
                                               pin number);
                         /

5.Nested table:

 Nested table is a collection of rows, represented as a column with in the main table.
For each record with in the main table, the nested table may contain multiple rows. In one sense, it’s a way of storing a one-to-many relationship with in one table.

Ex:
SQL> create or replace type emp_ty5 as object
        (desg varchar2(20),
         dname varchar2(20),
         doj date);
           /
6.What is view in SQL Server?

View is one of the database objects and act as virtual table. View contains SQL statements with specifics and stores in SQL Server.

7.What is the syntax to create view in SQL Server?

CREATE VIEW [ schema_name . ] view_name [ (column [ ,...n ] ) ]
[ WITH [ ,...n ] ]
AS select_statement [ ; ]
[ WITH CHECK OPTION ]

8.What are the advantages of views?

Views enable the developers to write common queries once as view use them in application.
User could able to access subset of data contained base tables (restricted tables) by using view.
Performance would be increased to complex queries by creating indexes on views.

9.What are the restrictions to view select statement?

Developer should not use INTO keyword
We should not Reference to a temporary table or table variable
We should not use COMPUTE or COMPUTE BY clause

10.What is the difference between a regular view and an indexed view?

A regular view is a SELECT statement that is referenced by a name and stored in SQL Server. It does not contain any data.

An indexed view is a view that has a clustered index created against it, which causes SQL Server to store the results of the query defined in the view on disk. An indexed view must meet very stringent requirements for the view, the base tables that the view references, and the index on the view.

11.What is Database Trigger ?

A Database Trigger is procedure (set of SQL and PL/SQL statements) that is automatically executed as a result of an insert in, update to, or delete from a table.

12. uses of Database Trigger ?

Database triggers can be used to automatic data generation, audit data modifications, enforce complex Integrity constraints, and customize complex security authorizations.

13.Difference between database triggers and form triggers?

-Data base trigger(DBT) fires when a DML operation is performed on a data base table. Form trigger(FT) Fires when user presses a key or navigates between fields on the screen
-Can be row level or statement level No distinction between row level and statement level.
-Can manipulate data stored in Oracle tables via SQL Can manipulate data in Oracle tables as well as variables in forms.
-Can be fired from any session executing the triggering DML statements. Can be fired only from the form that define the trigger.
-Can cause other database triggers to fire. Can cause other database triggers to fire, but not other form triggers.

Loops and Exceptions in Oracle

Loops and Exceptions in Oracle

1.What are the loops available oracle?

LOOPS: There are three types
1. Simple loop
2. While loop
3. for loop

1.Simple:

Ex:Declare
A number(2) := 1;
Begin
DBMS_OUTPUT.PUT_LINE( ‘welcome’ );
LOOP
DBMS_OUTPUT.PUT_LINE( ‘HELLO1’ );
DBMS_OUTPUT.PUT_LINE( ‘HELLO2’ );
Exit when A = 4;
A := A + 1;
END LOOP;
DBMS_OUTPUT.PUT_LINE( ‘THANK YOU’ );
END;
/

2.While:

Ex;Declare
A number(2) :=1;
Begin
DBMS_OUTPUT.PUT_LINE( ‘WELCOME’ );
While A <=4 loop
DBMS_OUTPUT.PUT_LINE( ‘HELLO1’ );
DBMS_OUTPUT.PUT_LINE( ‘HELLO2’ );
A := A + 1;
END LOOP;
DBMS_OUTPUT.PUT_LINE( ‘THANK YOU’ );
END;
/

3.FOR LOOP:

Numeric     FOR_LOOP ieterates over a specified range of integers.The range is part of an interation scheme,Which is enclosed by the keywords FOR and LOOP.
Ex:Declare
A number;
Begin
DBMS_OUTPUT.PUT_LINE( ‘WELCOME’ );
FOR A IN 1 .. 4 LOOP
DBMS_OUTPUT.PUT_LINE( ‘HELLO1’ );
DBMS_OUTPUT.PUT_LINE( ‘HELLO2’ );
END LOOP;
DBMS_OUTPUT.PUT_LINE( ‘THANK YOU’ );
END;
/

Note: in for loop the loop variable is implicitly declare.

4.What is the  Exceptions?

A:Runtime Errors are called as Exceptions. They are three types of Exceptions.
1.ORACLE Predefined Exception
2.ORACLE Non Predefined Exception
3.USER Defined Exception

5.Oracle Predefined Exception:

A:These Exceptions will have Exception name and Exception number. Examples of predefined Exceptions are:
       1.NO_DATA_FOUND
       2.TOO_MANY_ROWS
       3.ZERO_DIVIDE
       4.VALUE_ERROR
       5.DUP_VAL_ON_INDEX

6.USER DEFINED EXCEPTIONS:

A:These Exceptions are defined and controlled by the user. These Exceptions neither have predefined name nor have predefined number. Steps to handle user defined Exceptions.
Step1: Declare the Exception
Step2: Raised the Exception
Step3: Catch the Exception

7.ORACLE NON PREDEFINED EXCEPTIONS:

A:These Exceptions will have only Exception number. But does not have Exception name.
Steps to handle non predefined exceptions.
Syntax:
Step1: Declare the Exception
    <EXCEPTION_NAME> EXCEPTION;
Step2: Associate the Exception
    PRAGMA EXCEPTION_INIT(<EXCEPTION_NAME>,<EXCEPTION NO>);

Step3: Catch the Exception
    WHEN <EXCEPTION_NAME> THEN
    ------------------
    ------------------
    ------------------
    END;
       /
8.what is RAISE_APPLICATION_ERROR ?Why we are using this one in oracle?

A:RAISE_APPLICATION_ERROR is a procedure which is used to throw one error number and error message to the calling environment.
It internally performance rolls back.
ERROR number should be range of -20000 to -20999. ERROR message should be displayed less then or equal to 512 characters.

9.How many error reporting Functions are available in oracle?

A:They are two Error Reporting functions.
1. SQLCODE
2. SQLERRM

These error reporting functions are used in when others clause to identified the exception which is raised.
1.SQLCODE: It returns ERRORCODE
2.SQLERRM: It returns Exception number and Exception message.

Note: for NO_DATA_FOUND Exception SQLCODE will return 100.

10.VALUE_ERROR:

A:This Exception is raised when there is miss match with the value and data type of local variable or size of local variables.

11.NO_DATA_FOUND Exception:

A:This Exception is raised when select statement does not return any Row.

Ex:     Declare
    L_sal emp.sal%type;
    Begin
    DBMS_OUTPUT.PUT_LINE( ‘WELCOME’ );
    Select sal INTO L_sal from emp where empno = &empno;
    DBMS_OUTPUT.PUT_LINE(L_sal);
    DBMS_OUTPUT.PUT_LINE( ‘THANK YOU’ );
    EXCEPTION
    when NO_DATA_FOUND then
    DBMS_OUTPUT.PUT_LINE( ‘INVALID EMPNO’);
    END;
       /

Varrays and Clusters in Oracle

Varrays and Clusters in Oracle

1.What is VARRAYS?How to create?

A:varrays can also be used to create one-to-many relationship with in the table.
*creating varray:
Ex: create type dependent_brithdate_t5 as varray(10) of date;

2.Differences between nested tables and varrays***

Nested tables  :                                                
1.There is no restriction on size.      
2.Data is stored in special auxiliary Tables called as store tables.              

Varrays:
1. We need to define the maximum size.
2. Data is stored inline to the rest of the table data.

3.Why we are using Execute immediate?

A:One can call DDL statement like create, drop, truncate and etc from PL/SQL by using the “Execute immediate” statement

4.What is a cluster Key ?

The related columns of the tables are called the cluster key. The cluster key is indexed using a cluster index and its value is stored only once for multiple tables in the cluster.

5.Can Long/Long RAW be clustered ?

No

5.What is clusters ?

Group of tables physically stored together because they share common columns and are often used together is called Cluster.

6.What are the advantages of clusters ?

Access time reduced for joins.

7.What are the disadvantages of clusters ?

The time for Insert increases.

8.BULK COLLECT:

Bulk collect feature helps in improving the performance of explicit cursor programs.
Fetch statement can fetch all the rows from the cursor to the programs local variable at once thus helps in improving the performance.

9.What is the purpose of a cluster?

A:Oracle does not allow a user to specifically locate tables, since that is a part of the function of the RDBMS. However, for the purpose of increasing performance, oracle allows a developer to create a CLUSTER. A CLUSTER provides a means for storing data from different tables together for faster retrieval than if the table placement were left to the RDBMS.

10.schema

A:Specify the schema to contain the cluster. If you omit schema, Oracle Database creates the cluster in your current schema.

11.datatype

A:Specify the datatype of each cluster key column.

Restrictions on Cluster Datatypes Cluster datatypes are subject to the following restrictions:

You cannot specify a cluster key column of datatype LONG, LONG RAW, REF, nested table, varray, BLOB, CLOB, BFILE, or user-defined object type.
You cannot use the HASH IS clause if any column datatype is not INTEGER or NUMBER with scale 0.
You can specify a column of type ROWID, but Oracle Database does not guarantee that the values in such columns are valid rowids.

Procedures and Functions in Oracle

Procedures and Functions in Oracle

1.What is a procedure?

A.A procedure is a PL/SQL block which is compiled and permanently stored in the database for repeated execution.
Syntax:
create or replace procedure<procedure_Name>
IS
Begin
--------------
--------------
--------------
END;
  /

2.Types of Procedures

A.Procedure can have 3 types of parameters
   i.Inparameter
   ii.OutParameter
   iii.In Out parameter

3.Why we are using InParameter:

A.InParameter’s are used to accept values from the user.
Ex: create a procedure which accepts two numbers and display the num?
*Create or replace procedure ADD_NUM(A IN number, B IN number)
IS
C number;
Begin
C := A + B;
DBMS_OUTPUT.PUT_LINE(‘The sum is…’||C);
END;
  /

4.Query to see all the list of procedures:

Select object_NAME from user_objects where object_TYPE = ‘PROCEDURE’;

5.To see the source code of a procedure:

Select text from user_source where NAME = ‘ADD_NUM’;

6.Spool command:

A.This command is used to extract the character which we can see in SQL*PLUSE environment to a text file.

7.Out parameters:

out parameters are used to return the value to the user.
Ex:
Create a procedure which accepts two numbers and return the sum?
    Create or replace procedure ret_sum
                                                     (A IN number,B IN number, C OUT number)
    IS
    Begin
    C := A + B;
    END;
      /
8.What are the Steps to invoke procedures which are having out parameters:

A.Step 1: create bind variable
    SQL> variable N number
Step 2: execute the procedure
    SQL> EXEC Ret_sum(10,20,:N)
Step 3: print bind variable
    SQL>print N

9.IN out parameters:

A.These parameters are used to accept the value as well as to return the value to user.
Ex: create a procedure which accepts a number and return its square?
    Create of replace procedure ret_square1(A IN out number)
    IS
    Begin
    A := A * A;
    END;
      /
10.What is mean by Functions?Syntax of functions?

A.A function is a named PL/SQL block which must and should return a value.
Syntax: create or replace function<FUNCTION_NAME>(VAR1 datatype, var2 datatype,…….,varn datatype);
Return datatype
IS
Begin
-------
-------
-------
END;
  /

11.Differences between procedure and functions?

Procedures:                                                                             
1.Procedures need not return any            
value can return one or more than              .
one value.
2.DML commands are allowed.                  
3.Can not be invoked from select               
statement.                                                        .

Functions :
1. Must and should return only one value.
2. DML commands are not allowed.
3. Can be invoked from select statement and expressions.

12.Which Query used to see list of all the functions?

A.Select object_Name from user_objects where object_type = ‘function’;
Procedures and functions are called sub programs

13.Give the structure of the procedure ?

A.PROCEDURE name (parameter list.....)
is
local variable declarations
BEGIN
Executable statements.
Exception.
exception handlers
end;

14.Explain how procedures and functions are called in a PL/SQL block ?

Function is called as part of an expression.
sal := calculate_sal ('a822');
procedure is called as a PL/SQL statement
calculate_bonus ('A822');

15.What are advantages fo Stored Procedures?

Extensibility,Modularity, Reusability, Maintainability and one time compilation.

Cursors and Joins in Oracle

Cursors and Joins in Oracle

1.What is a cursor?

A.Oracle uses work area to execute SQL statements and store processing information PL/SQL construct called a cursor lets you name a work area and access its stored information A cursor is a mechanism used to fetch more than one row in a Pl/SQl block.

2.How many types are availble?

A.They are two types of cursors.
    1. Implicit cursor
    2. Explicit cursor

3.Implicit cursor

A.All the activities related to cursors like opening the cursor, processing the cursor and closing the cursor are done automatically. Hence these cursor are called as implicit cursor

4.Explicit cursor

A.All the activities related to cursor like.
1.Opening the cursor
2.Processing the cursor
3.Closing the cursor

Act should be done by the developer. Hence this cursor is called explicit cursors.
We should use explicit cursors to run a select statement.

5.What are the attributes of  implicit cursors?

A.Implicit cursor attributes: They are 4 implicit cursor attributes.

i.SQL%ISOPEN
ii.SQL%FOUND
iii.SQL%NOTFOUND
iv.SQL%ROWCOUNT

6.Difference between an implicit & an explicit cursor.?

A.only one row. However,queries that return more than one row you must declare an explicit cursor or use a cursor FOR loop. Explicit cursor is a cursor in which the cursor name is explicitly assigned to a SELECT statement via the CURSOR...IS statement. An implicit cursor is used for all SQL statements Declare, Open, Fetch, Close. An explicit cursors are used to process multirow SELECT statements An implicit cursor is used to process INSERT, UPDATE, DELETE and single row SELECT. .INTO statements.

7.What are the steps to write a explicit cursor?

A.Steps to use explicit cursors:
Step 1: declare the cursor
Step 2: open the cursor
Step 3: fetch data from cursor to local variables
Step 4: close the cursor

8.Attributes of explicit cursor?

A.EXPLICIT CURSOR ATTRIBUTES: These are four explicit cursor attributes.
1. %ISOPEN
2. %FOUND
3. %NORFOUND
4. %ROWCOUNT

9.What are various joins used while writing SUBQUERIES?

A.Self join-Its a join foreign key of a table references the same table. Outer Join--Its a join condition used where One can query all the rows of one of the tables in the join condition even though they don't satisfy the join condition.
Equi-join--Its a join condition that retrieves rows from one or more tables in which one or more columns in one table are equal to one or more columns in the second table.

10.What is a OUTER JOIN?

A.Outer Join--Its a join condition used where you can query all the rows of one of the tables in the join condition even though they don?t satisfy the join condition.

11.Inner join

A.An inner join using either of the equivalent queries gives the intersection of the two tables, i.e. the two rows they have in common.

Applets in Java

Applets in Java

1). What is the difference between a window and a frame ?

A. A window is a frame without any borders and title, whereas a frame contains borders and title.

2. What is event delegation model ?

A. Event delegation model represents that when an event is generated by the user on a component,
it is delegated to a listener interface and the listener calls a mehtod in response to the event. Finally ,the event is handled by the method.

3. Which model is used to provide actions to AWT components ?

A. Event delegation model.

4. What is an adapter class ?

A. An adapter class is an implementation class of a listener which contains all methods
implemented with empty body. For example, WindowAdapter is an adapter class of WindowListener
interface. Adapter classes reduce overhead on programming while working with listener interfaces.

5. What is anonymous inner class ?

A. Anonymous inner class is an inner class whose name is not mentioned, and for which only one object is created.

6. What is the default layout in a frame ?

A. BorderLayout.

7. What is the default layout in an applet ?

A. FlowLayout.

8.What are Java Foundation classes ?

A. Java Foundation classes (JFC) represented a class library developed in pure Java which is an extension to AWT.

9. Discuss about the MVC architecture in JFC/ swing ?

A. Model- View – Controller is a model used in swing components. Model represents the data of
the component. View represents its appearance and controller is a mediater between the model and the
view.MVC represents the separation of model of an object from its view and how it is controlled.

10. What are the various window panes available in swing ?

A. There are 4 window panes: Glass pane, Root pane, Layered pane, and Content pane.

11. Where are the borders available in swing ?

A. All borders are available in BorderFactory class in javax.swing.border package.


12.What is applet life cycle ?

A. An applet is born with init( ) method and starts functioning with start( ) method. To stop the
applet, the stop( ) method is called and to terminate the applet completely from memory, the destroy( )
method is called. Once the applet is terminated, we should reload the HTML page again to get the
applet start once again from init( ) method. This cyclic way of executing the methods is called applet
life cycle.

13. Where are the applets executed ?

A. Applets are executed by a program called applet engine which is similar to virtual machine that
exists inside the web browser at client side.

14. What is HotJava?

A.Hot Java is the first applet-enabled browser developed in Java to support running of applets.

15. Which tag is used to embed an applet into a HTML page ?

A. <APPLET> tag is used to insert an applet into HTML page.

16. What is a generic type ?

A. A generic type represents a class or an interface that is type-safe. It can act on any data type.

17. Whai is erasure ?

A. Creating non-generic version of a generic type by the Java compiler is called erasure.

18. What is auto boxing ?

A. Auto boxing refers to creating objects and storing primitive data types automatically by the
compiler.

Oracle Introduction

Oracle Introduction

1.What is Oracle table?
    
A table is the basic unit of data storage in an Oracle database. The tables of a database hold all of the user accessible data. Table data is stored in rows and columns.

2.What is Oracle?
    
Oracle is relational database management system, which organizes data in the form of tables. Oracle makes efficient use of all system resources, on all hardware architecture, to deliver unmatched performance, price performance and scalability.

3. What is an Oracle view?
    
A view is a virtual table. Every view has a query attached to it. (The query is a SELECT statement that identifies the columns and rows of the table(s) the view uses.)
Post Your Answers

4.What are the collection types in oracle?
    
Collection types are objects that contain multiple sets of values. There are two kinds of collection types:
varrays
object-type tables

5.What is a table space?
    
A database is divided into Logical Storage Unit called tablespaces.
A tablespace is a logical grouping of related data.
In Oracle, user data is logically stored in tablespaces which is physically stored in data files.

7.What is the difference between a relation and a relationship?

The difference between a relation and a relationship is that a relation is another name for a table, whereas a relationship is a way to correlate, or join, two or more tables.

8.Name two new features of Oracle8?
    
New features of Oracle8 include partitioned tables, index-only tables, and improved parallelism.

9.What are the three types of DML (Data Manipulation Language) statements?
    
There are three types of DML statements are :
INSERT
UPDATE
DELETE
MERGE .

10.What is a log group?
    
A log file group is a set of identical redo log files. This provides redundancy to protect against media failure.

11.What are Clusters?
    
Clusters are groups of one or more tables physically stores together to share common columns and are often used together.

12.What are the advantages of views?
    
Provide an additional level of table security, by restricting access to a predetermined set of rows and columns of a table.
Hide data complexity.
Simplify commands for the user.
Present the data in a different perspective from that of the base table
Store complex queries.

13.What are the various types of queries?
    
The types of queries are :
Normal Queries
Sub Queries
Co-related queries
Nested queries
Compound queries

Apr 3, 2014

Synchronization in UFT

Synchronization in UFT
----------------
What is Synchronization?

Why Synchronization?

When Synchronization is required?

How to Synchronize?

    Insert Wait statement (VBS)

    Wait (Time in seconds) / Wait Time in seconds

    Ex: Wait (17)

    Insert Synchronization point (UFT)

Syntax:

Object.WaitProperty "PropertyName", property value, Time in milli seconds

Ex:
Window("Flight Reservation").WinButton("Delete Order").WaitProperty "enabled", True, 30000

    Increase Tool default Time (UFT)

Select appropriate method
--------------------------------------
'Exist Property for Synchronization
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe","","C:\Program Files\HP\Unified Functional Testing\samples\flight\app\","open"
Dialog("Login").Activate @@ hightlight id_;_526058_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set "asdf" @@ hightlight id_;_264602_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "533d757daccdc22ee3f0018cac5e3c1584349abe" @@ hightlight id_;_395670_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog("Login").WinButton("OK").Click @@ hightlight id_;_395662_;_script infofile_;_ZIP::ssf4.xml_;_

If Window("Flight Reservation").Exist(10) Then
Window("Flight Reservation").Activate @@ hightlight id_;_591594_;_script infofile_;_ZIP::ssf5.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_264860_;_script infofile_;_ZIP::ssf6.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_133798_;_script infofile_;_ZIP::ssf7.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "1" @@ hightlight id_;_133796_;_script infofile_;_ZIP::ssf8.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_133794_;_script infofile_;_ZIP::ssf9.xml_;_
End If
------------------------------------------------------
'Exist Propery for Error Handling
If Not Dialog("Login").Exist(3) Then
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe","","C:\Program Files\HP\Unified Functional Testing\samples\flight\app\","open"
End If
Dialog("Login").Activate @@ hightlight id_;_526058_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set "asdf" @@ hightlight id_;_264602_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "533d757daccdc22ee3f0018cac5e3c1584349abe" @@ hightlight id_;_395670_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog("Login").WinButton("OK").Click @@ hightlight id_;_395662_;_script infofile_;_ZIP::ssf4.xml_;_
----------------------------------------------
Window("Flight Reservation").Activate @@ hightlight id_;_2689534_;_script infofile_;_ZIP::ssf1.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_461482_;_script infofile_;_ZIP::ssf2.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_1313334_;_script infofile_;_ZIP::ssf3.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "4" @@ hightlight id_;_527008_;_script infofile_;_ZIP::ssf4.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_1444396_;_script infofile_;_ZIP::ssf5.xml_;_
Window("Flight Reservation").WinEdit("Tickets:").Set 1 @@ hightlight id_;_1706630_;_script infofile_;_ZIP::ssf7.xml_;_
Window("Flight Reservation").WinButton("Update Order").Click @@ hightlight id_;_1968478_;_script infofile_;_ZIP::ssf8.xml_;_
Wait 8
Message = Window("Flight Reservation").ActiveX("Threed Panel Control").GetROProperty("text")

If Message = "Update Done..." Then
    Msgbox "Order Updated"
    Else
    Msgbox "Order Not Updated"
End If
----------------------------------------------
Advantages of Wait statement
-----------------------------
i) It won't Corrupt

ii) No object Reference is required

iii) It can be used internally as well as externally

iv) It can be used for Recordable and Non-Recordable statements

(* In order to capture screen shots during execution wait is useful)

V) In order to observe the Test execution process then wait statement is the only option.
-------------------------------------------------------