Wednesday, September 4, 2013

Software Testing Interview Questions

100 Frequently asked software Testing Interview Questions from Guru99 Site

1. What is the MAIN benefit of designing tests early in the life cycle? 
It helps prevent defects from being introduced into the code.
2. What is risk-based testing? 
Risk-based testing is the term used for an approach to creating a test strategy that is based on prioritizing tests by risk. The basis of the approach is a detailed risk analysis and prioritizing of risks by risk level. Tests to address each risk are then specified, starting with the highest risk first.
3. A wholesaler sells printer cartridges. The minimum order quantity is 5. There is a 20% discount for orders of 100 or more printer cartridges. You have been asked to prepare test cases using various values for the number of printer cartridges ordered. Which of the following groups contain three test inputs that would be generated using Boundary Value Analysis? 
4, 5, 99
4. What is the KEY difference between preventative and reactive approaches to testing? 
Preventative tests are designed early; reactive tests are designed after the software has been produced.
5. What is the purpose of exit criteria? 
To define when a test level is complete.
6. What determines the level of risk? 
  The likelihood of an adverse event and the impact of the event
7. When is used Decision table testing? 
  Decision table testing is used for testing systems for which the specification takes the form of rules or cause-effect combinations. In a decision table the inputs are listed in a column, with the outputs in the same column but below the inputs. The remainder of the table explores combinations of inputs to define the outputs produced.
Learn More About Decision Table Testing Technique in the Video Tutorial here
 8. What is the MAIN objective when reviewing a software deliverable?
To identify defects in any software work product.
9. Which of the following defines the expected results of a test? Test case specification or test design specification.
Test case specification.
10. Which is a benefit of test independence?
It avoids author bias in defining effective tests.  
11. As part of which test process do you determine the exit criteria?
Test planning.  
12. What is beta testing?
Testing performed by potential customers at their own locations.  
13. Given the following fragment of code, how many tests are required for 100% decision coverage?
if width > length
   then biggest_dimension = width
     if height > width
             then biggest_dimension = height
     end_if
else biggest_dimension = length  
            if height > length 
                then biggest_dimension = height
          end_if
end_if
14. You have designed test cases to provide 100% statement and 100% decision coverage for the following fragment of code. if width > length then biggest_dimension = width else biggest_dimension = length end_if The following has been added to the bottom of the code fragment above. print "Biggest dimension is " & biggest_dimension print "Width: " & width print "Length: " & length How many more test cases are required?
None, existing test cases can be used.  
15. Rapid Application Development ?
Rapid Application Development (RAD) is formally a parallel development of functions and subsequent integration. Components/functions are developed in parallel as if they were mini projects, the developments are time-boxed, delivered, and then assembled into a working prototype. This can very quickly give the customer something to see and use and to provide feedback regarding the delivery and their requirements. Rapid change and development of the product is possible using this methodology. However the product specification will need to be developed for the product at some point, and the project will need to be placed under more formal controls prior to going into production.
16. What is the difference between Testing Techniques and Testing Tools?
Testing technique: – Is a process for ensuring that some aspects of the application system or unit functions properly there may be few techniques but many tools.
Testing Tools: – Is a vehicle for performing a test process. The tool is a resource to the tester, but itself is insufficient to conduct testing  
Learn More About Testing Tools  here
17. We use the output of the requirement analysis, the requirement specification as the input for writing …
User Acceptance Test Cases  
18. Repeated Testing of an already tested program, after modification, to discover any defects introduced or uncovered as a result of the changes in the software being tested or in another related or unrelated software component:
Regression Testing
19. What is component testing ?
Component testing, also known as unit, module and program testing, searches for defects in, and verifies the functioning of software (e.g. modules, programs, objects, classes, etc.) that are separately testable. Component testing may be done in isolation from the rest of the system depend-ing on the context of the development life cycle and the system. Most often stubs and drivers are used to replace the missing software and simulate the interface between the software components in a simple manner. A stub is called from the software component to be tested; a driver calls a component to be tested. Below Unit Testing Video:-
20. What is functional system testing ?
Testing the end to end functionality of the system as a whole.
21. What is the benefits of Independent Testing
Independent testers see other and different defects and are unbiased.  
22. In a REACTIVE approach to testing when would you expect the bulk of the test design work to be begun?
After the software or system has been produced.
23. What are the different Methodologies in Agile Development Model?
There are currently seven different Agile methodologies that I am aware of:
 Extreme Programming (XP)
 Scrum
 Lean Software Development
 Feature-Driven Development
 Agile Unified Process
 Crystal
 Dynamic Systems Development Model (DSDM) 

24. Which activity in the fundamental test process includes evaluation of the testability of the requirements and system?
A Test analysis and design.
25. What is typically the MOST important reason to use risk to drive testing efforts?
  Because testing everything is not feasible.  
26. Which is the MOST important advantage of independence in testing?
An independent tester may be more effective at finding defects missed by the person who wrote the software.  
27. Which of the following are valid objectives for incident reports?
i. Provide developers and other parties with feedback about the problem to enable identification, isolation and correction as necessary,
ii.Provide ideas for test process improvement,
iii.Provide a vehicle for assessing tester competence
iv.Provide testers with a means of tracking the quality of the system under test
28. Consider the following techniques. Which are static and which are dynamic techniques?
i. Equivalence Partitioning.
ii. Use Case Testing.
iii.Data Flow Analysis.
iv.Exploratory Testing.
v. Decision Testing.
vi. Inspections.
Data Flow Analysis and Inspections are static, Equivalence Partitioning, Use Case Testing, Exploratory Testing and Decision Testing are dynamic.
29. Why are static testing and dynamic testing described as complementary?
Because they share the aim of identifying defects but differ in the types of defect they find.  
30. What are the phases of a formal review ?
In contrast to informal reviews, formal reviews follow a formal process. A typical formal review process consists of six main steps:
  1.  Planning
  2.  Kick-off
  3.  Preparation
  4.  Review meeting
  5.  Rework
  6.  Follow-up.  

31. What is the role of moderator in review process?
The moderator (or review leader) leads the review process. He or she deter-mines, in co-operation with the author, the type of review, approach and the composition of the review team. The moderator performs the entry check and the follow-up on the rework, in order to control the quality of the input and output of the review process. The moderator also schedules the meeting, disseminates documents before the meeting, coaches other team members, paces the meeting, leads possible discussions and stores the data that is collected.
Learn More About Review process in Video Tutorial here

32. What is an equivalence partition (also known as an equivalence class)?
An input or output range of values such that only one value in the range becomes a test case.  
33. When should configuration management procedures be implemented?
During test planning.
34. A Type of functional Testing, which investigates the functions relating to detection of threats, such as virus from malicious outsiders.
Security Testing  
35. Testing where in we subject the target of the test , to varying workloads to measure and evaluate the performance behaviors and ability of the target and of the test to continue to function properly under these different workloads. Load Testing
36. Testing activity which is performed to expose defects in the interfaces and in the interaction between integrated components is:
Integration Level Testing  
37. What are the Structure-based (white-box) testing techniques ?
Structure-based testing techniques (which are also dynamic rather than static) use the internal structure of the software to derive test cases. They are com-monly called 'white-box' or 'glass-box' techniques (implying you can see into the system) since they require knowledge of how the software is implemented, that is, how it works. For example, a structural technique may be concerned with exercising loops in the software. Different test cases may be derived to exercise the loop once, twice, and many times. This may be done regardless of the func-tionality of the software.  
38. When should be performed Regression testing ?
After the software has changed or when the environment has changed
39. When should testing be stopped?
It depends on the risks for the system being tested
40. What is the purpose of a test completion criterion?
To determine when to stop testing  
41. What can static analysis NOT find?
For example memory leaks  
42. What is the difference between re-testing and regression testing?
Re-testing ensures the original fault has been removed; regression testing looks for unexpected sideeffects  
43. What are the Experience-based testing techniques ?
In experience-based techniques, people's knowledge, skills and background are a prime contributor to the test conditions and test cases. The experience of both technical and business people is important, as they bring different perspectives to the test analysis and design process. Due to previous experience with similar systems, they may have insights into what could go wrong, which is very useful for testing.  
44. What type of review requires formal entry and exit criteria, including metrics? Inspection 45. Could reviews or inspections be considered part of testing?
Yes, because both help detect faults and improve quality  
46. An input field takes the year of birth between 1900 and 2004 What are the boundary values for testing this field ? 1899,1900,2004,2005  
47. Which of the following tools would be involved in the automation of regression test? a. Data tester b. Boundary tester c. Capture/Playback d. Output comparator.
d. Output comparator  
48. To test a function,what has to write a programmer, which calls the function to be tested and passes it test data.
  Driver
49. What is the one Key reason why developers have difficulty testing their own work?
Lack of Objectivity
50.“How much testing is enough?”
The answer depends on the risk for your industry, contract and special requirements. 51. When should testing be stopped? It depends on the risks for the system being tested.  
52. Which of the following is the main purpose of the integration strategy for integration testing in the small?
To specify which modules to combine when, and how many at once.
53. What is the purpose of a test completion criterion?
  To determine when to stop testing  
54. Given the following code, which statement is true about the minimum number of test cases required for full statement and branch coverage?
     Read p
     Read q
     IF p+q> 100
          THEN Print "Large"
    ENDIF
    IF p > 50
          THEN Print "p Large"
    ENDIF

 1 test for statement coverage, 2 for branch coverage
55. What is the difference between re-testing and regression testing?
  Re-testing ensures the original fault has been removed; regression testing looks for unexpected side-effects.  
56. Which review is normally used to evaluate a product to determine its suitability for intended use and to identify discrepancies?
Technical Review.
57. Why we use decision tables?.
The techniques of equivalence partitioning and boundary value analysis are often applied to specific situations or inputs. However, if different combinations of inputs result in different actions being taken, this can be more difficult to show using equivalence partitioning and boundary value analysis, which tend to be more focused on the user interface. The other two specification-based tech-niques, decision tables and state transition testing are more focused on business logic or business rules. A decision table is a good way to deal with combinations of things (e.g. inputs). This technique is sometimes also referred to as a 'cause-effect' table. The reason for this is that there is an associated logic diagramming technique called 'cause-effect graphing' which was sometimes used to help derive the decision table
58. Faults found should be originally documented by who?
By testers.  
59. Which is the current formal world-wide recognized documentation standard?
There isn’t one.  
60. Which of the following is the review participant who has created the item to be reviewed?
Author
61. A number of critical bugs are fixed in software. All the bugs are in one module, related to reports. The test manager decides to do regression testing only on the reports module.
Regression testing should be done on other modules as well because fixing one module may affect other modules.
62. Why does the boundary value analysis provide good test cases?
Because errors are frequently made during programming of the different cases near the ‘edges’ of the range of values.  
63. What makes an inspection different from other review types?
It is led by a trained leader, uses formal entry and exit criteria and checklists.
64. Why can be tester dependent on configuration management?
Because configuration management assures that we know the exact version of the testware and the test object.
65. What is a V-Model ?
A software development model that illustrates how testing activities integrate with software development phases
66. What is maintenance testing?
Triggered by modifications, migration or retirement of existing software  
67. What is test coverage?
Test coverage measures in some specific way the amount of testing performed by a set of tests (derived in some other way, e.g. using specification-based techniques). Wherever we can count things and can tell whether or not each of those things has been tested by some test, then we can measure coverage.  
68. Why is incremental integration preferred over “big bang” integration?
Because incremental integration has better early defects screening and isolation ability  
69. When do we prepare RTM (Requirement traceability matrix), is it before test case designing or after test case designing?
The would be before. Requirements should already be traceable from Review activities since you should have traceability in the Test Plan already. This question also would depend on the organisation. If the organisation do test after development started then requirements must be already traceable to their source. To make life simpler use a tool to manage requirements.
70. What is called the process starting with the terminal modules ?
Bottom-up integration  
71. During which test activity could faults be found most cost effectively?
During test planning  
72. The purpose of requirement phase is
To freeze requirements, to understand user needs, to define the scope of testing
73. How much testing is enough?
The answer depends on the risks for your industry, contract and special requirements 74. Why we split testing into distinct stages? Each test stage has a different purpose.
75. Which of the following is likely to benefit most from the use of test tools providing test capture and replay facilities? a) Regression testing b) Integration testing c) System testing d) User acceptance testing
  Regression testing  
76. How would you estimate the amount of re-testing likely to be required?
Metrics from previous similar projects and discussions with the development team
77. What studies data flow analysis ?
The use of data on paths through the code.
78. What is Alpha testing?
Pre-release testing by end user representatives at the developer’s site.
79. What is a failure?
Failure is a departure from specified behaviour.  
80. What are Test comparators ?
Is it really a test if you put some inputs into some software, but never look to see whether the software produces the correct result? The essence of testing is to check whether the software produces the correct result, and to do that, we must compare what the software produces to what it should produce. A test comparator helps to automate aspects of that comparison.
81. Who is responsible for document all the issues, problems and open point that were identified during the review meeting Scribe  
82. What is the main purpose of Informal review
Inexpensive way to get some benefit  
83. What is the purpose of test design technique?
Identifying test conditions and Identifying test cases
84. When testing a grade calculation system, a tester determines that all scores from 90 to 100 will yield a grade of A, but scores below 90 will not. This analysis is known as:
  Equivalence partitioning  
85. A test manager wants to use the resources available for the automated testing of a web application. The best choice is Tester, test automater, web specialist, DBA  
86. During the testing of a module tester ‘X’ finds a bug and assigned it to developer. But developer rejects the same, saying that it’s not a bug. What ‘X’ should do?
Send to the detailed information of the bug encountered and check the reproducibility
87. A type of integration testing in which software elements, hardware elements, or both are combined all at once into a component or an overall system, rather than in stages.
Big-Bang Testing  
88. In practice, which Life Cycle model may have more, fewer or different levels of development and testing, depending on the project and the software product. For example, there may be component integration testing after component testing, and system integration testing after system testing.
V-Model
89. Which technique can be used to achieve input and output coverage? It can be applied to human input, input via interfaces to a system, or interface parameters in integration testing.
Equivalence partitioning  
90. “This life cycle model is basically driven by schedule and budget risks” This statement is best suited for…
V-Model  
91. In which order should tests be run?
The most important tests first  
92. The later in the development life cycle a fault is discovered, the more expensive it is to fix. why?
The fault has been built into more documentation,code,tests, etc  
93. What is Coverage measurement?
It is a partial measure of test thoroughness.  
94. What is Boundary value testing?
Test boundary conditions on, below and above the edges of input and output equivalence classes.
95. What is Fault Masking ?
Error condition hiding another error condition.
96. What does COTS represent?
Commercial Off The Shelf.  
97.The purpose of wich is allow specific tests to be carried out on a system or network that resembles as closely as possible the environment where the item under test will be used upon release?
Test Environment
98. What can be though of as being based on the project plan, but with greater amounts of detail?
Phase Test Plan  
99. What is exploratory testing?
  Exploratory testing is a hands-on approach in which testers are involved in minimum planning and maximum test execution. The planning involves the cre-ation of a test charter, a short declaration of the scope of a short (1 to 2 hour) time-boxed test effort, the objectives and possible approaches to be used. The test design and test execution activities are performed in parallel typi-cally without formally documenting the test conditions, test cases or test scripts. This does not mean that other, more formal testing techniques will not be used. For example, the tester may decide to use boundary value analysis but will think through and test the most important boundary values without necessarily writing them down. Some notes will be written during the exploratory-testing session, so that a report can be produced afterwards.  
100. What is failure?
Deviation from expected result to actual result

Where Are All The Good Testers?

Posted: 03 Sep 2013 10:24 AM PDT
I’m trying to fill two technical tester positions.  It’s exhausting.  All the resumes are starting to look the same.  They all tout:
§ Extensive knowledge of the SDLCWho cares?  I’ve been testing for 15 years and I’ve never encountered a situation where extensive knowledge of the SDLC has come in handy…I’m not even sure what it is.  Who is motivating this?  Are there that many Test Managers out there saying, “what we really need, is a tester who knows the SDLC”?
§ Understanding of test automation tools like QTP?  “Understanding of”?
§ Ability to map test cases to requirements in Quality Center.  It’s been 6 years since I’ve seen Quality Center but I don’t recall it being that difficult a task.
§ Performed different types of tests like Functional, Regression, Smoke, UAT, White Box, Black Box, Grey Box, and End-to-end.  Darn, I was really looking for someone who could write “integration tests”.  Oh well.
One resume said:
§ Extensive QA experience via hands-on testing?  Is there a way to gain experience without being hands-on?
Another said:
§ Fixed tested bugs and coordinated with developers in release of bug fixes during every Sprint Run.  Hmmm.  Perhaps you should start by testing your resume verbiage.
During an interview I asked:
Me: According to your resume, you worked on a team using Test Driven Development.  Was it effective?
Candidate:  Oh yes.  At the end of Sprints, if the developers had time, they would write some unit tests for Stories we were about to release to production.
During another, I asked the following easy question:
Me: What are some attributes of a good bug report?
Candidate: Documenting the bug is the most important attribute.
Finally, after an interview with me, for a programming position, the candidate remarked, “That’s odd, I’ve never seen a man in a QA role.”.  It reminds me of a little post I made years ago that almost lost me some friends.

BTW - If you live in the Atlanta area, have excellent DB and SQL skills, and are capable of testing something without a UI, please drop me a note.  I may have an awesome job waiting for you.

Questions w.r.t Test Plan and Testing Process

Test Plan Questions


1) What is Test Planning?
The activity of establishing or updating a test plan.

2) What is Test Plan?
A document describing the scope, approach, resources and schedule of intended test activities. It identifies amongst others test items, the features to be tested, the testing tasks, who will do each task, degree of tester independence, the test environment, the test design techniques and entry and exit criteria to be used, and the rationale for their choice, and any risks requiring contingency planning. It is a record of the test planning process.

3) What are the important tasks in Test Planning stage?
a) Understanding and analyzing the requirements
b) Risk Analysis
c) Test Strategy Implementation
d) Test Estimations (Scope of the project, Time, Budget, Avaialable resources)
e) Team formation
f) Test Plan Documentation
g) Configuration management Planning
h) Traceability Matrix
i) Defining Test Environment set up

4) What are the reference documents for Test Planning?
Reference Documents for Test Planning stage:
  • Requirements
  • Project Plan
  • Test Strategy 
  • Design docs
  • Process guidelines docs
  • Corporate standards docs
5)  What is the Output of Test Planning stage?
Test Plan Document

6) How Test Lead defines Test Lab set-up?
Test Lead defines Test Environment set-up based on System Requirements specification document.

7) What are the considerable factors for Test Estimations?
Scope of the project,
Time,
Budget,
Available Human and Environmental resources

8) Who is the author of Test Plan document?
Test Lead or Team Lead

9) Who approves Test Plan document?
Generally Project Manager approves the Test Plan Document after review process.

10) What is Test Point Analysis?
A formula based test estimation method based on function point analysis.

11) What is Software Test Process?
The fundamental test process comprises test planning and control, test analysis and design, test implementation and execution, evaluating exit criteria and reporting, and test closure activities.

12) What is Function Point Analysis?
A Method aiming to measure the size of the functionality of an information system. The measurement is independent of the technology. This measurement may be used as a basis for the measurement of productivity, the estimation of the needed resources, and project control.

13) What is Entry criteria in Test Plan?
The set of generic and specific conditions for permitting a process to go forward with a defined task, e.g. test phase. The purpose of entry criteria is to prevent a task from starting which would entail more (wasted) effort compared to the effort needed to remove the failed entry criteria.

14) What is Exit criteria in Test Plan? 
The set of generic and specific conditions, agreed upon with the stakeholders, for permitting a process to be officially completed. The purpose of exit criteria is to prevent a task from being considered completed when there are still outstanding parts of the task which have not been finished. Exit criteria are used to report against and to plan when to stop testing.

15) What is Test deliverable?
Any test (work) product that must be delivered to someone other than the test (work) product’s author.

16) What are the Test deliverable's in Software Test Process?
Test deliverable's
  • Test plan document,
  • Test cases,
  • Test design specifications,
  • Tools and their outputs,
  • Simulators,
  • Static and dynamic generators,
  • Error logs and execution logs,
  • Problem reports and corrective actions.
19) What is Master Test Plan?
A test plan that typically addresses multiple test levels.

20) What is Wide Band Delphi?
An expert based test estimation technique that aims at making an accurate estimation using the collective wisdom of the team members.

SQL Queries Interview Questions and Answers

SQL Queries Interview Questions and Answers :

1. What is the difference between “delete” , “truncate” and “drop” commands

Delete CommandTruncate CommandDrop Command
Delete Command Belongs to DMLTruncate Command Belongs to DDLDrop Command Belongs to DDL
Can be Used to delete entire Table dataCan be Used to delete entire Table dataCan be Used to delete entire Table data and also the structure
Can be used to delete specific rows using where clauseCan't be used to delete specific rows using where clauseCan't be used to delete specific rows using where clause
Can be rolled backCan't be rolled backCan't be rolled back

2.What is the syntax for writing insert queries
We can write insert queries in two ways :
a.insert into <table-name> values (value1,value2,…..)
b.insert into <table-name> (col1,col2,……) values (value1,value2,…..)

3.What is the difference between primary key and unique key

Unique KeyPrimary Key
a.A table can contain more than one unique keya.A table can contain only one primary key (can be one/more columns)
b.Unique key allows one null valueb.Primary key will not allow null values

4.What are DDL and DML commands .

DDL (DataDifinition Language)DML (Data Manipulation Language)
CreateSelect
AlterInsert
TruncateUpdate
DropDeletet

5. What is the difference between sub queries and joins
a.Sub Queries :
To write sub queries between two or more tables, there is no need to be relation exist among those tables
b.Joins:
To write joins between two or more tables, there should be relation exist among those tables

6. What are the different  types of joins and explain them
Inner Join
Left Outer Join
Right Outer Join
Full Outer Join

7. Write  syntax for views and stored procedures
View Syntax:
Create view <view-name> as select <column names> from <table-name> where <condition>
Stored Procedure Sysntax:
Create procedure <procedure-name> as begin select <column names> from <table-name> end

Note: These are only sample examples, we can write in different ways also.

8. Relation between views and the their parent tables
If we modify the views table,it effects the parent tables and vice versa

9. Write syntax for update query
Update <table-name> set some_co1l=value1, some_col2=value2 where some_col3=value3

10.What are the different constraints available in sql and Explain
Not Null      -> enforces a column to Not accept Null values
Unique       -> uniquely identifies each record in a database table
Primary Key -> uniquely identifies each record in a database table and it cannot contain NULL values.
Foreign Key -> A Foreign Key in one table points to a PRIMARY KEY in another table.
Check         -> It is used to limit the value range that can be placed in a column.
Default       -> It is used to insert a default value into a column.

11.By default how the column data would display if use order by <column>
By default the order by would display the data in ascending order
Syntax:
a. select <col-names> from <table-name> order by <col-names>
It will display the results in ascending order
select <col-names> from <table-name> order by <col-names> desc
It will display the results in descending order
select <col-names> from <table-name> order by <col-names> asc
It will display the results in ascending order

12.What is the operator in sql to find pattern match
Like
Select <colnames> from <table-name> where <col> like <pattern>
Ex:
a.
Select ename from emp where ename like ‘v%’
It will display all the names which are start with ‘v’
b.
Select ename from emp where ename not like ‘v%’
It will display other than all the names which are start with ‘v’


13. What is the purpose of ‘distinct’ in sql
Distinct is used to display only the different values

Ex:
Select distinct <col-names> from <table-name>
Select distinct ename from emp

14. What is the difference between union and union all
The UNION operator selects only distinct values by default. To allow duplicate values, use UNION ALL
Select <col-names> from <table1> union select <col-names> from <table2>
Select <col-names> from <table1> union all select <col-names> from <table2>

Q.What is Database testing ?

Testing the backend databases like comparing the actual results with expected results.

Q. What we test in database testing

Data bas testing basically include the following.
1)Data validity testing.
2)Data Integrity testing
3)Performance related to database.
4)Testing of Procedure, triggers and functions.
For doing data validity testing you should be good in SQL queries
For data integrity testing you should know about referential integrity and different constraint.
For performance related things you should have idea about the table structure and design.
For testing Procedure triggers and functions you should be able to understand the same.

Q.What are the different stages involved in Database Testing?

In DB testing we need to check for,
1.The field size validation
2.Check constraints.
3.Indexes are done or not (for performance related issues)
4.Stored procedures.
5.The field size defined in the application is matching with that in the db.

Q.What SQL statements have you used in Database Testing?
DDL
DDL is Data Definition Language statements. Some examples: • CREATE • ALTER - • DROP -• TRUNCATE -• COMMENT - • RENAME – 
DML
DML is Data Manipulation Language statements. Some examples: • SELECT - • INSERT - • UPDATE - • DELETE - • MERGE - UPSERT -• CALL - • EXPLAIN PLAN - • LOCK TABLE – 
DCL
DCL is Data Control Language statements. Some examples: • GRANT - • REVOKE - • COMMIT - • SAVEPOINT - • ROLLBACK - COMMIT -• SET TRANSACTION - This are the Database testing commands.

Q.What is a Primary Key?

A primary key is a single column or multiple columns defined to have unique values that can be used as row identifications

Q.What is a Foreign Key?

A foreign key is a single column or a multiple columns defined to have values that can be mapped to a primary key in another table.

Q.What we normally check for in the Database Testing?

Database testing involves some in-depth knowledge of the given application and requires more defined plan of approach to test the data. Key issues include:
1)data Integrity
2)data validity
3)data manipulation and updates.
Tester must be aware of the database design concepts and implementation rules

Q.How to Test database in Manually? Explain with an example

Observing that operations, which are operated on front-end is effected on back-end or not.
The approach is as follows:
While adding a record thru' front-end check back-end that addition of record is effected or not.
So same for delete, update...
Ex: Enter employee record in database thru' front-end and check if the record is added or not to the back-end (manually).

Q.What is an Index?

An index is a single column or multiple columns defined to have values pre-sorted to speed up data retrieval speed.

Q.What are NULL values?

NULL represents no value
NULL is not the same as an empty string ‘’
NULL is not same as zero value (0)
NULL can be used as any data type
NULL should not be used in any comparison operators
NULL has its own equality operator IS and not-equality operator IS NOT

Q.What is the difference between oracle, sql and sql server ? 

•Oracle is based on RDBMS.
•SQL is Structured Query Language.
•SQL Server is another tool for RDBMS provided by MicroSoft. 

Q.Why you need indexing? where that is Stored and what you mean by schema object? For what purpose we are using view?

We can't create an Index on Index.. Index is stoed in user_index table. Every object that has been created on Schema is Schema Object like Table, View etc. If we want to share the particular data to various users we have to use the virtual table for the Base table. So that is a view.
Indexing is used for faster search or to retrieve data faster from various table. Schema containing set of tables, basically schema means logical separation of the database. View is crated for faster retrieval of data. It's customized virtual table. we can create a single view of multiple tables. Only the drawback is..view needs to be get refreshed for retrieving updated data.

Q.What is the difference between TRUNCATE and DELETE commands?

•Both will result in deleting all the rows in the table .TRUNCATE call cannot be rolled back as it is a DDL command and all memory space for that table is released back to the server. TRUNCATE is much faster.Whereas DELETE call is an DML command and can be rolled back.

Q.Which system table contains information on constraints on all the tables created ? 
USER_CONSTRAINTS,
system table contains information on constraints on all the tables created

Q.Common SQL Syntax used in database interaction

a.Select Statement
SELECT "column_name" FROM "table_name"

b.Distinct
SELECT DISTINCT "column_name" FROM "table_name"

c.Where
SELECT "column_name" FROM "table_name" WHERE "condition"

d.And/Or
SELECT "column_name" FROM "table_name" WHERE "simple condition" {[AND|OR] "simple condition"}+

e.In
SELECT "column_name" FROM "table_name" WHERE "column_name" IN ('value1', 'value2', ...)

f.Between
SELECT "column_name" FROM "table_name" WHERE "column_name" BETWEEN 'value1' AND 'value2'

g.Like
SELECT "column_name" FROM "table_name" WHERE "column_name" LIKE {PATTERN}

h.Order By
SELECT "column_name" FROM "table_name" [WHERE "condition"] ORDER BY "column_name" [ASC, DESC]

i.Count
SELECT COUNT("column_name") FROM "table_name"

j.Group By
SELECT "column_name1", SUM("column_name2") FROM "table_name" GROUP BY "column_name1"

k.Having
SELECT "column_name1", SUM("column_name2") FROM "table_name" GROUP BY "column_name1" HAVING (arithematic function condition)

l.Create Table Statement
CREATE TABLE "table_name" ("column 1" "data_type_for_column_1","column 2" "data_type_for_column_2",…)

m.Drop Table Statement
DROP TABLE "table_name"

n.Truncate Table Statement
TRUNCATE TABLE "table_name"

m.Insert Into Statement
INSERT INTO "table_name" ("column1", "column2", ...) VALUES ("value1", "value2", ...)

o.Update Statement
UPDATE "table_name" SET "column_1" = [new value] WHERE {condition}

p.Delete From Statement
DELETE FROM "table_name" WHERE {condition}

Q.SQL CREATE VIEW Syntax
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

Q.what operator performs pattern matching?

Pattern matching operator is LIKE and it has to used with two attributes 
1.% means matches zero or more characters and  
2._( underscore ) means matching exactly one character

Q.What is cluster.cluster index and non cluster index ? 

Clustered Index:- A Clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table may have only one clustered index.Non-Clustered Index:- A Non-Clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows in the disk. The leaf nodes of a non-clustered index does not consists of the data pages. instead the leaf node contains index rows.

Q.What is GROUP BY?

The GROUP BY keywords has been added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called. Without the GROUP BY functionality, finding the sum for each individual group of column values was not possible.

Q.What are defaults? Is there a column to which a default can't be bound?

A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and timestamp columns can't have defaults bound to them. 

Q.What is an extended stored procedure? Can you instantiate a COM object by using T-SQL?

An extended stored procedure is a function within a DLL (written in a programming language like C, C++ using Open Data Services (ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement. See books online to learn how to create extended stored procedures and how to add them to SQL Server. You can instantiate a COM (written in languages like VB, VC++) object from T-SQL by using sp_OACreate stored procedure.

Q.What is Trigger?

A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.

Q.What is User Defined Functions? What kind of User-Defined Functions can be created?

User-Defined Functions allow defining its own T-SQL functions that can accept 0 or more parameters and return a single scalar data value or a table data type.
Different Kinds of User-Defined Functions created are: 

1.Scalar User-Defined Function A Scalar user-defined function returns one of the scalar data types. Text, ntext, image and timestamp data types are not supported. These are the type of user-defined functions that most developers are used to in other programming languages. You pass in 0 to many parameters and you get a return value.

2.Inline Table-Value User-Defined Function An Inline Table-Value user-defined function returns a table data type and is an exceptional alternative to a view as the user-defined function can pass parameters into a T-SQL select command and in essence provide us with a parameterized, non-updateable view of the underlying tables.

3.Multi-statement Table-Value User-Defined Function A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a TSQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored procedure which can also return record sets

Q.What is Identity?

Identity (or AutoNumber) is a column that automatically generates numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID column also generates numbers; the value of this cannot be controlled. Identity/GUID columns do not need to be indexed.

Q.What is blocking and how would you troubleshoot it?

Blocking happens when one connection from an application holds a lock and a second connection requires a conflicting lock type. This forces the second connection to wait, blocked on the first.

Q.Determine the name sex and age of the oldest student. 

SELECT Name, Gender, (CURRENT_DATE-Dtnaiss)/365 AS Age
FROM Student
WHERE (CURRENT_DATE-Dtnaiss) /365 =
( SELECT MAX(( CURRENT_DATE-Dtnaiss) /365) FROM Student); 



Q.How to find out the 10th highest salary in SQL query?

Table - Tbl_Test_Salary 
Column - int_salary
select max(int_salary) 
from Tbl_Test_Salary 
where int_salary in(select top 10 int_Salary from Tbl_Test_Salary order by int_salary)

Q.How to test a SQL Query in WinRunner? With out using Database Checkpoints?

By writing scripting procedure in the TCL we can connect to the database and we can test database and queries.

Q.How does you test whether a database in updated when information is entered in the front end?

With database check point only in WinRunner, but in manual we will go to front end using some information. Will get some session names using that session names we search in backend. If that information is correct then we will see query results.

Q.Write a query to find the 5th details from a table

SELECT column_name FROM table_name WHERE auto_incremented_id =
(SELECT TOP 1 auto_incremented_id FROM
(SELECT TOP 3 auto_incremented_id FROM employee ORDER BY auto_incremented_id ASC)
table_name ORDER BY auto_incremented_id DESC);

Q.Write a Query to display the Top N rows ?

MySQL
SELECT column_name FROM table_name
LIMIT number

SQL Server
SELECT TOP number/percent column_name FROM table_name

Oracle
SELECT column_name FROM table_name 
WHERE ROWNUM<= number

Q.Difference between Stored Procedure and Trigger?

•we can call stored procedure explicitly.
•but trigger is automatically invoked when the action defined in trigger is done.
ex: create trigger after Insert on 
•this trigger invoked after we insert something on that table.
•Stored procedure can't be inactive but trigger can be Inactive.
•Triggers are used to initiate a particular activity after fulfilling certain condition.It need to define and can be enable and disable according to need. 

Q.What is the advantage to use trigger in your PL?
 
A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL statements A trigger is a solution to the restrictions of a constraint. For instance: 1.A database column cannot carry PSEUDO columns as criteria where a trigger can. 2. A database constraint cannot refer old and new values for a row where a trigger can. 
Triggers are fired implicitly on the tables/views on which they are created. There are various advantages of using a trigger. Some of them are:
•Suppose we need to validate a DML statement(insert/Update/Delete) that modifies a table then we can write a trigger on the table that gets fired implicitly whenever DML statement is executed on that table.
•Another reason of using triggers can be for automatic updation of one or more tables whenever a DML/DDL statement is executed for the table on which the trigger is created.
•Triggers can be used to enforce constraints. For eg : Any insert/update/ Delete statements should not be allowed on a particular table after office hours. For enforcing this constraint Triggers should be used.
•Triggers can be used to publish information about database events to subscribers. Database event can be a system event like Database startup or shutdown or it can be a user even like User loggin in or user logoff. 

Q.What are the tradeoffs with having indexes?
1.Faster selects, slower updates. 
2.Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index. 

Q.What is "normalization"? "Denormalization"? Why do you sometimes want to denormalize?
Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier.
Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing. 

Q.What is a "constraint"?
A constraint allows you to apply simple referential integrity checks to a table. There are four primary types of constraints 
PRIMARY/UNIQUE - enforces uniqueness of a particular table column. But by default primary key creates a clustered index on the column, where are unique creates a non-clustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only DEFAULT - specifies a default value for a column in case an insert operation does not provide one. FOREIGN KEY - validates that every value in a column exists in a column of another table. CHECK - checks that every value stored in a column is in some specified list. Each type of constraint performs a specific type of action. Default is not a constraint. NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only constraint which is not a table level constraint. 

Q.What is the system function to get the current user's details such as userid etc. ?
USER
USER_ID
USER_NAME
CURRENT_USER
SUSER_SID
HOST_NAME
SYSTEM_USER
SESSION_USER

Q.What is Stored Procedure?
A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.

Q.What are the different isolation levels ?

An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. Here are the other isolation levels (in the ascending order of isolation): Read Uncommitted, Read Committed, Repeatable Read, Serializable. 

Q.What would happen if you create an index on each column of a table ?

If you create an index on each column of a table, it improves the query performance, as the query optimizer tool of the Database engine can choose from all the existing indexes to come up with an efficient execution plan. At the same time, data modification operations (such as INSERT, UPDATE, DELETE) will become slow, as every time data changes in the table, all the indexes need to be updated. Another disadvantage is that, indexes need disk space, the more indexes you have, more disk space is used.

Q.The SQL statement to find the departments that have employees with a salary higher than the average employee salary

SELECT name FROM dept
WHERE id IN
(
SELECT dept_id FROM emp
WHERE sal >
(SELECT avg(sal)FROM emp)
)

Q.Write the SQL to use a sub query which will not return any rows - when just the table structure is required and not any of the data.

CREATE TABLE new_table AS
SELECT * from table_orig WHERE 1=0; 
The sub query returns no data but does return the column names and data types to the 'create table' statement.
 categories Oracle FAQ, Oracle Interview Questions, Oracle Interview Questions and Answers, SQL and PL/SQL Interview Questions, SQL FAQ, sql for testers, SQL Interview questions
RECEBA AS NOVIDADES DO BLOG EM SEU E-MAIL