0% found this document useful (0 votes)
35 views

All Mcqs(SQL & Testing)Ans.....

Uploaded by

Adityareddy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

All Mcqs(SQL & Testing)Ans.....

Uploaded by

Adityareddy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1. You are working with a database containing employee information.

You want to find employees


who are either in the Engineering department and have a salary greater than $80,000,

or employees in the Sales department with a Senior job title.


which SQL query should you use to achieve this

Please choose a correct answer.

a) SELECT * FROM employees WHERE (department ='Engineering' AND salary > 80000) OR
(department ='Sales' AND job_title 'Senior');
b) SELECT * FROM employees WHERE (department ='Engineering' OR department 'Sales') AND
(salary > 80000 OR job_title = 'Senior');

c) SELECT * FROM employees WHERE (department = 'Engineering' AND salary > 80000) AND
(department = 'Sales' AND job title = 'Senior' );

d) SELECT * FROM employees WHERE (department = Engineering AND salary > 80000) XOR
(department = 'Sales' AND job title = 'Senior' );

Ans:- a) SELECT * FROM employees WHERE (department ='Engineering' AND salary > 80000) OR
(department ='Sales' AND job_title 'Senior');

--------------------------------------------------------------------------------------------------------------------------------------

2. There is a Student table that has two column IDs and names.

We need to update the name of the student with id = 10 as John. Which of the following query is
correct?

Please choose a correct answer.

a) UPDATE STUDENT SET NAME="John" WHERE ID=10;

b) UPDATE NAME FROM STUDENT SET NAME =" John" WHERE ID=10;

c) UPDATE NAME ="John" FROM STUDENT WHERE ID=10;

d) None of the mentioned.

Ans:- a) UPDATE STUDENT SET NAME="John" WHERE ID=10;

--------------------------------------------------------------------------------------------------------------------------------------

3. Assume you are a database administrator for a company that is updating an existing SQL database
with new product data. The new data requires a change in the data type for the
price column in the product table from decimal to an integer.

Which SQL command should you use to change the data type?

a) MODIFY ALTER COLUMN

b)ALTER COLUMN

c)CHANGE ALTER COLUMN

d)ALTER UPDATE COLUMN Ans:- b)ALTER COLUMN


--------------------------------------------------------------------------------------------------------------------------------------

4. You want to allow records to be inserted with a blank email ID field initially. However, you need to
ensure that this blank field is automatically populated with a random email ID ending
in '@gmail.com' after insertion.

Which combination of constraints and mechanisms should you use to achieve this?

Please choose a correct answer.

a) CHECK

b) DEFAULT

c) NOT NULL
d) UNIQUE '@gmail.com'

Ans:- b) DEFAULT

--------------------------------------------------------------------------------------------------------------------------------------

5. Assume thnat your company has a database that stores information about employees and their
salaries. The HR department needs to update the salary of a specific employee who has just received
a raise. Which DML command should the HR admin use to update the salary of the employee with
employee_id 101?

Please choose a correct answer.

a) UPDATE employees SET salary = 75000 WHERE employee id =101;

b) DELETE FROM employees WHERE employee_id =101;

c) SELECT * FROM employees WHERE employee_id = 101;

d) INSERT INTO employees (employee_id, first_name, last_name, salary) VALUES (101, 'John', 'Doe,
75000);

Ans:- a) UPDATE employees SET salary = 75000 WHERE employee id =101;

--------------------------------------------------------------------------------------------------------------------------------------

6. When publishing a test execution report, which key attribute(s) must the report contain? Select all
that apply.
Please choose all correct answers.

a) Test cases

b) Test environment and configuration

c) Defects

d) Root cause of any failures

Ans:- Correct answers are a, b, c.


--------------------------------------------------------------------------------------------------------------------------------------

7. Which of the following metrics would be most useful to monitor during test execution?
Please choose a correct answer.

a. Percentage of test cases written

b. Number of test environments remaining to be configured

c. Number of defects found and fixed

d. Percentage of requirements for which a test has been written


Ans. c. Number of defects found and fixed

--------------------------------------------------------------------------------------------------------------------------------------

8. Which of the following comparisons of component testing and system testing are TRUE?

Please choose a correct option among a, b and c.

a. Component testing verifies the functioning of software modules, program objects, and classes
that are separately testable, whereas system testing verifies interfaces between components and
interactions with different parts of the system.

b. Test cases for component testing are usually derived from component specifications, design
specifications, or data models, whereas test cases for system testing are usually derived from
requirement specifications, functional specifications or use cases.
c. Component testing focuses on functional characteristics, whereas system testing focuses on
functional and non-functional characteristics.

Ans. a. Component testing verifies the functioning of software modules, program objects, and
classes that are separately testable, whereas system testing verifies interfaces between
components and interactions with different parts of the system.

--------------------------------------------------------------------------------------------------------------------------------------

9. Software is used to calculate Employee bonuses. Bonus cannot be negative, but it can be zero. The
bonus is based on the duration of the employment. An employee can be employed

for less than or equal to 2 years, more than 2 years but less than 5 years, 5 to 10 years, or longer
than 10 years. Depending on this period of employment, an employee will get a bonus of
0%, 10%, 25% or 35%.

How many equivalence partitions are needed to test the calculation of the bonus.

Please choose a correct answer.

a. 3

b. 5

c. 2
d. 4

Ans. d. 4

--------------------------------------------------------------------------------------------------------------------------------------

10. Which of the following are the main phases of a formal review?

Please choose a correct answer.

a. Initiation, status, preparation, review meeting, rework, follow up.

b. Planning, preparation, review meeting, rework, closure, follow up.

c. Planning, kick off individual preparation, review meeting, rework, follow up.

d. Preparation, review meeting, rework, closure, follow up, root cause analysis.

Ans. c. Planning, kick off individual preparation, review meeting, rework, follow up.

Verify my answer

--------------------------------------------------------------------------------------------------------------------------------------

11. In software testing, a "flaky test" is a term used to describe a test that:

Please choose a correct answer.

a. Always produces the same result under the same conditions.

b. Produces non-deterministic outcomes, sometimes passing and sometimes failing, under the same
conditions.

c. Is only applicable for performance and load testing scenarios.

d. Refers to a test that is not automated but conducted manually.

e. is specifically designed to test the security features of the application.

Ans. b. Produces non-deterministic outcomes, sometimes passing and sometimes failing, under
the same conditions.

--------------------------------------------------------------------------------------------------------------------------------------

12. How much testing is enough?

Please choose a correct answer.

a. This question is impossible to answer

b. This question is easy to answer


c. The answer depends on the risk for your industry, contract and special requirements

d. This answer depends on the maturity of your developers.

Ans. c. The answer depends on the risk for your industry, contract and special requirements

--------------------------------------------------------------------------------------------------------------------------------------
13. Which of the following function(s) is(are) typically supported by a software quality information
system?

(Select all that apply)

Please choose all correct answers.

a. Test Management

b. System design

c. Defect Tracking

d. Configuration Management
Ans. a, c and d

--------------------------------------------------------------------------------------------------------------------------------------

14. The most important thing about early test design is that it?

Please choose a correct answer.

a. makes test preparation easier

b. means inspections are not required

c. can prevent fault multiplication

d. will find all faults

Ans. c. can prevent fault multiplication

--------------------------------------------------------------------------------------------------------------------------------------

15) Assume that you are working as a database administrator for a company that has recentiy
implemented a new payroll system. As part of this system, you need to create a new table named
'employees' that will store information about all the company's employees. The employees table
should have the given columns:

emp_id (integer, auto-incremented, primary key)

first_name (string )

last_name (string)

job_title (string)

hire_date (date)

salary (decimal)

Which SQL statement can be used to create the "employees table with the required columns?
Analyze the given choices and select the correct option.

Ans. CREATE TABLE employees (

emp_id INT PRIMARY KEY AUTO_INCREMENT,


first_name VARCHAR(255),

last_name VARCHAR(255),

job_title VARCHAR(255), hire date DATE,salary DECIMAL (10, 2) );

--------------------------------------------------------------------------------------------------------------------------------------

16. Consider a scenario where a company possesses twO tables: the first one holds customer details
with columns such as customer id, customer name, and email and the second one contains order
information with columns like order_id, customer_id, total_amount, and order date
Describe how you would formulate a SQL query to combine these tables and obtain the total
amount spent by each customer.

Options:

a. SELECT customer.customer id, SUM(total amount) AS total spent

FROM Customer

INNER 0IN order ON customer id = order.customer id

GROUP BY customer id;

b. SELECT customer_id, SUM(order_amount) AS total_spent

FROM customer

INNER JOIN order ON customer id = order.customer id

GROUP BY customer.customer_ id;

c. SELECT customer.customer_ id, SUM(order.total amount) AS total spent


FROM customer

INNER JOIN order ON customer.customer id = order.customer id

GROUP BY customer.customer id;

Ans.
c. SELECT customer.customer_ id, SUM(order.total amount) AS total spent

FROM customer
INNER JOIN order ON customer.customer id = order.customer id

GROUP BY customer.customer id;

--------------------------------------------------------------------------------------------------------------------------------------

17. Which SQL query retrieves information about the primary key columns of the "customers table?

a. SELECT CONSTRAINT NAME, COLUMN NAME

FROM INFORMATION SCHEMA.KEY COLUMN USAGE

WHERE TABLE NAME ='Customers " AND CONSTRAINT NAME = 'PRIMARY;


b. SELECT CONSTRAINT NAME, COLUMN NAME

FROM INFORMATION SCHEMA. KEY COLUMN USAGE

WHERE REFERENCED TABLE NAME - 'customers AND CONSTRAINT TYPE - PRIMARY KEY';

c. SELECT cOLUMN NAME, CONSTRAINT NAME

FROM INFORMATION SCHEMA.CONSTRAINT_COLUMN USAGE

WHERE TABLE NAME = 'customers' AND CONSTRAINT TYPE = 'PRIMARY KEY';

d. SELECT COLUMN_NAME, CONSTRAINT_NAME

FROM INFORMATION _SCHEMA.CONSTRAINT_COLUMN_USAGE

WHERE REFERENCE TABLE_NAME = 'customers' AND CONSTRAINT_TYPE = 'PRIMARY';

Ans.
c. SELECT COLUMN NAME, CONSTRAINT NAME

FROM INFORMATION SCHEMA.CONSTRAINT_COLUMN USAGE

WHERE TABLE NAME = 'customers' AND CONSTRAINT TYPE = 'PRIMARY KEY';

--------------------------------------------------------------------------------------------------------------------------------------
18. Assume that you work for a company that operates an e-commerce website. You are tasked with
updating the order status for a particular customer's orders.

You are provided with the given table schema:

name VARCHAR(50),

email VARCHAR (50) UNIQUE

CREATE TABLE orders (

id INT PRIMARY KEY,

customer_ id INT,

status VARCHAR(20)

Which SQL statement can be used to update the status of all the orders for the customer with the
email [email protected] to "shipped?

Options:

a. UPDATE orders
SET status shipped

WHERE LOIN(
SELECT (d

FROM customers

WHERE email ); [email protected]'

b. UPDATE orders o

JOIN customers c ON o.customer_id = c.id

SET o.status = 'shipped'

WHERE c.email'[email protected]';

c. UPDATE orders

WHERE customer_id= (

SELECT id

FROM customers

WHERE email [email protected]'

SET status 'shipped';

d. UPDATE orders o

SET status 'shipped"

WHERE c.email'[email protected]'

JOIN customers c ON o.customer_id = c.id;

Ans.
b. UPDATE orders o

JOIN customers c ON o.customer_id = c.id

SET o.status = 'shipped'

WHERE c.email'[email protected]';
--------------------------------------------------------------------------------------------------------------------------------------
19. In a large e-commerce database, you've been tasked with retrieving a list of the top 5 customers
who have made the most distinct product purchases in the year 2021 where the schema of the table
"order details" is as follows: "order id INT (PK)", "customer id INT", "product id INT", "order date
DATE".

Which SQL query should you use to accomplish this?


a. SELECT TOP 5 customer_id, COUNT(DISTINCT product_id) AS distinct purchases FROM
order_details

WHERE YEAR(order_date) = 2021


GROUP BY customer id

ORDER BY distinct purchases DESC

b. SELECT customer_id, COUNT(DISTINCT product_id) AS distinct purchases FROM order_details

WHERE YEAR(order date) = 2021

GROUP BY customer_id
ORDER BY distinct_purchases ASC

c. SELEC DISTINCT TOP 5 customer id, COUNT (product_id) AS distinct purchases FROM order details.

WHERE YEAR(order date) = 2021

GROUP BY customer_id

ORDER BY distinct purchases DESC

d. SELECT TOP 5 customer_id, SUM(DISTINCT product_id) AS distinct_purchases FROM order details

WHERE YEAR(order_date) = 2021

GROUP BY customer_id

ORDER BY distinct purchases DESC

Ans.
a. SELECT TOP 5 customer_id, COUNT(DISTINCT product_id) AS distinct_purchases

FROM order_details

WHERE YEAR(order_date) = 2021

GROUP BY customer_id

ORDER BY distinct_purchases DESC

--------------------------------------------------------------------------------------------------------------------------------------

20. Assume that you are tasked with maintaining an existing SQL database that is used to store
custor deletion of a column from the "customer" table that is no longer needed. data for a retail
company. A new requirement has been added that requires the

Which SQL command should you use to delete the column?

Please choose a correct answer.


a. DROP TABLE ALTER

b. DROP ALTER COLUMN

c. ALTER TABLE customer

DROP COLUMN column name;

d. DELETE TABLE customer

ALTER COLUMN;

Ans. c. ALTER TABLE customer

DROP COLUMN column name;

--------------------------------------------------------------------------------------------------------------------------------------

21. You want to join two tables in a database and what is the correct syntax among the following for
the same?

a. select * from Table_1 ON Table_2 INNER JOIN Table_1. Id = Table_2.Id;

b. select * from Table_1 INNER JOIN Table_2 ON Table_1.Id = Table_2. Id;

c. select * from Table_1 AND Table_2 INNER JOIN ON Table_1.Id =Table_2.Id;

d. None of these
Ans. b. select * from Table_1 INNER JOIN Table_2 ON Table_1.Id = Table_2. Id;

--------------------------------------------------------------------------------------------------------------------------------------

22. Assume that you have a database that contains information about a large number of employees
in a company. Each employee has a unique employee ID, a first and last name, and a department ID
that corresponds to the department they work in. Additionally, there is a table that contains
information about the departments, including the department ID and the department name.

You want to retrieve the first and last names of employees who work in departments with more
than 50 employees and also include the department name in the output. Which query can you use
will achieve this task?

Please choose a correct answer,

a. SELECT e.first_name, e.last_name, d.department_name FROM employees e INNER JOIN


departments d ON e.department_id = d.department_id WHERE (SELECT COUNT() FROM employees
WHERE department_id = e.department_id) > 50;

b. SELECT e.first_name, e.last_name, d.department_name FROM employees e INNER JOIN


departments d ON e.department_id = d.department_id WHERE COUNT() > 50 GROUP BY
e.first_name, e.last_name, d.department_name;

c. SELECT e.first_name, e.last_name, d.department_name FROM employees e INNER JOIN


departments d ON e.department_id= d.department_id HAVING COUNT() > 50;
d. SELECT e.first_name, e.last_name, d.department_name FROM employees e INNER JOIN
departments d ON e.department_id = d.department_id WHERE e.department_id IN (SELECT
department_id FROM employees GROUP BY department_id HAVING COUNT(*) > 50);

Ans.
d. SELECT e.first_name, e.last_name, d.department_name FROM employees e INNER JOIN
departments d ON e.department_id = d.department_id WHERE e.department_id IN (SELECT
department_id FROM employees GROUP BY department_id HAVING COUNT(*) > 50);

--------------------------------------------------------------------------------------------------------------------------------------

23. Assume that you are working with a database that has a table called "sales_data" with the
columns "customer_name", "product_name", "product_category", and "sales_amount". You want to
create a view that shows the total sales for each product category. You also want to create an index
on the "product_category" column for performance optimization.

Given here is the SQL query that you wrote:

CREATE VIEW total_sales_by_category AS

SELECT product_category, SUM(sales_amount) AS total_sales

FROM sales_data
GROUP BY product_category;

CREATE INDEX sales_by_category_idx ON sales_data(product_category);

Which option denotes the error in the SQL query that you wrote? Analyze the given choices and
select the correct option.
Please choose a correct answer.

a. The view should have been created with the name "total_sales_per_category", not
"total_sales_by_category"

b. The index should have been created on the "total sales" column, not the "product_category"
column.

c. The index should have been created on the "total_sales_by_category" view, not the "sales_data"
table.

d. There is no error in the SQL query.

ANS:- c. The index should have been created on the "total_sales_by_category" view, not the
"sales_data" table.

--------------------------------------------------------------------------------------------------------------------------------------

24. You have a table named 'employees' with the following columns:

'employee_id', 'first name', 'last_name', 'salary', and 'department_id'

You are tasked with updating the salary of employees in the 'Finance' department to reflect a 10%
salary increase.
Which SQL UPDATE statement accomplishes this task?

Please choose a correct answer.

a) UPDATE employees SET salary =salary* 1.10 WHERE department_id = (SELECT department_id
FROM employees WHERE department_id = "Finance');

b) UPDATE employees SET salary =salary*1.10 WHERE department_id ='Finance';

c) UPDATE employees SET salary =salary *1.10 WHERE employee_id IN (SELECT employee_id FROM
employees WHERE department_id= 'Finance");
d) UPDATE employees SET salary=salary *1.10 WHERE department_id IN (SELECT department_id
FROM employees WHERE department_id ='Finance");

Ans;- b) UPDATE employees SET salary =salary*1.10 WHERE department_id ='Finance';

--------------------------------------------------------------------------------------------------------------------------------------

25. Assume that you are asked to create a new table for the customer data of an online store. The
table should have columns for the customer's name, email address and phone number. Which SCL
command should you use to create the table in this scenario?

Select the correct option from the given choices

a) CREAT

b) ALTER

c) INSERT

d) UPDATE

Ans:- a) CREAT

--------------------------------------------------------------------------------------------------------------------------------------

26. Which of the following SQL statements defines a FOREIGN KEY constraint on the DEPT NO
column of the EMP table?
please choose correct option:

a) CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35), deptno NUMBER(7,2) NOT NULL,
CONSTRAINT emp_deptno_fk FOREIGN KEY deptno REFERENCES dept deptno );

b) CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35), deptno NUMBER(7,2) FOREI GN
KEY REFERENCES dept deptno);

c) CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35) deptno NUMBER (7,2) NOT NULL,
CONSTRAINT emp_deptno_fk FOREIGN KEY (deptno) REFERENCES dept (deptno));
d)CREATE TABLE EMP (cmpno NUMBER (4), ename VARCHAR2(35), deptno NUMBER(2,2) FOREIGN
KEY CONSTRAINT emp deptno fk REFERENCES dept (deptno));

ANS:- c) CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35) deptno NUMBER (7,2)
NOT NULL, CONSTRAINT emp_deptno_fk FOREIGN KEY (deptno) REFERENCES dept (deptno));
--------------------------------------------------------------------------------------------------------------------------------------

27. Consider that you have a table called "Orders with the columns OrderID", "CustomerID",
"OrderDate, and Order Total".

You need to write a query that will return all the orders placed in the year 2023 sorted by order date
in descending order Which query can you use to fulfill your requirement? Analyze the given choices
and select the correct option

Please choose atonectans

a) SELECT * FROM Orders WHERE YEAR(OrderDate) =2023 ORDER BY OrderDate

b) SELECT * FROM Orders WHERE YEAR(OrderDate) =2023 ORDER BY CustomerID DESC


c) SELECT * FROM Orders WHERE YEAR(OrderDate)=2023 ORDER BY OrderDate DESC

d) SELECT * FROM Orders WHERE YEAR(OrderDate) =2023 ORDER BY CustomerID ASC

ANS:- c) SELECT * FROM Orders WHERE YEAR(OrderDate)=2023 ORDER BY OrderDate DESC

--------------------------------------------------------------------------------------------------------------------------------------

28. As a payroll manager for tech company with employees in different locations how can you use
sql code to calculate the average Salary of employees in the IT department who are located in a
specific location For example 'xyz' which sql query ?

ANS:- SELECT AVG(salary) AS average_salary

FROM payroll_table
WHERE department = 'IT' AND location = 'xyz';

--------------------------------------------------------------------------------------------------------------------------------------
29. Want to do where working with software development models?

a) To adapt the models to the context of project and product characteristics.

b) To choose the waterfall model because it is the first and best proven model.

c) To start with the V-model and then move to either iterative or incremental models.

d) To orally change the organization to fit the model and not vice versa.

Answer: a) To adapt the models to the context of project and product characteristics.
--------------------------------------------------------------------------------------------------------------------------------------

30. A test plan outline contain which of the following

1) Test deliverables 2) Test items 3) Responsibilities.

Ans:- Select 1,2 and 3

--------------------------------------------------------------------------------------------------------------------------------------
(doubt)31. What is the term used to define that specific task is done?
Ans. Sashimi

--------------------------------------------------------------------------------------------------------------------------------------

32. Which of the following options as the most creative and challenging phase of software

development Model?

a) Feasibility study

b) Maintenance

c) Design

d) All of the above

Answer: c) Design

--------------------------------------------------------------------------------------------------------------------------------------

33. What ethical hacking?

a) Informing and trying to hack the system

b) A type of security test

c) Part of functional test

d) Part of performance test

Answer: b) A type of security test

--------------------------------------------------------------------------------------------------------------------------------------
34. Which of the following option are not a part of the Software Testing Life Cycle (STLC)?

A) Test Planning

B) Test case execution

C) Environment setup

D) Application development

Answer: D) Application development


--------------------------------------------------------------------------------------------------------------------------------------

35. Which of the following statements is correct regarding NFR testing?

a) NFR testing requires test cases to be prepared

b) NFR testing does not require test cases

c) The type of NFR testing decides whether test case is needed or not

d) NFR testing requires functional test case and no other separate test case is needed

Answer: c) The type of NFR testing decides whether test case is needed or not
--------------------------------------------------------------------------------------------------------------------------------------

36. Which of the following environments is fare used to perform alpha testing?

a) Real test environment

b) Virtual environment

c) Distributed environment

d) Single machine environment

e) All of the given options

Answer: a) Real test environment

--------------------------------------------------------------------------------------------------------------------------------------

37. Which of the following is a static test?

a) Code inspection

b) Coverage analysis

c) Usability assessment

d) Installation test

Answer: a) Code Inspection

--------------------------------------------------------------------------------------------------------------------------------------

38. Which of the following environment are used to perform alpha testing?

a) Real time environment

b) Virtual environment

c) Distributed environment

d) Single machine environment

e) All of the given option

Answer: e) All the given option

--------------------------------------------------------------------------------------------------------------------------------------

39. An input field takes the year of birth between 1900 and 2004.

What is the boundary values for testing this field?

a) 190,020,042,005

b) 1900, 2004

c) 1,899,190,020,042,000

d) 189,919,001,901,200,000,000,000

Answer: b) 1900, 2004


--------------------------------------------------------------------------------------------------------------------------------------

40. What is the main difference between a walkthrough and an inspection?

a) A walkthrough is lead by the author, whilst an inspection is lead by a trained

moderator.

b) An inspection has a trained leader, whilst a walkthrough has no leader.

c) Authors are not present during inspections, whilst they are during

walkthroughs.

d) An inspection is lead by the author, whilst a walkthrough is lead by a trained

moderator.

Answer: a) A walkthrough is lead by the author, whilst an inspection is lead by

a trained moderator.

--------------------------------------------------------------------------------------------------------------------------------------

41. which of the following would be a good starting point for troubleshooting if your router is not
translating.

Ans:- check your interfaces for the correct configuration

--------------------------------------------------------------------------------------------------------------------------------------
42. The most important thing about early test design is that it.

Ans:- can help prevent faults or defects from multiplying

--------------------------------------------------------------------------------------------------------------------------------------
43. consider the nick assigned a task to isolated all students are between age group of 18 to 30 years
at his school he has a table of his school named student in the db with column ID Name Email and
age in order to ensure that Age column and contain values between 18 and 30 which constraint
should nick use

Ans;- ALTER TABLE student

ADD CONSTRAINT check_age_range CHECK (age BETWEEN 18 AND 30);

You might also like