All Mcqs(SQL & Testing)Ans.....
All Mcqs(SQL & Testing)Ans.....
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?
b) UPDATE NAME FROM 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?
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?
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?
d) INSERT INTO employees (employee_id, first_name, last_name, salary) VALUES (101, 'John', 'Doe,
75000);
--------------------------------------------------------------------------------------------------------------------------------------
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
c) Defects
7. Which of the following metrics would be most useful to monitor during test execution?
Please choose a correct answer.
--------------------------------------------------------------------------------------------------------------------------------------
8. Which of the following comparisons of component testing and system testing are TRUE?
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.
a. 3
b. 5
c. 2
d. 4
Ans. d. 4
--------------------------------------------------------------------------------------------------------------------------------------
10. Which of the following are the main phases of a formal review?
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:
b. Produces non-deterministic outcomes, sometimes passing and sometimes failing, under the same
conditions.
Ans. b. Produces non-deterministic outcomes, sometimes passing and sometimes failing, under
the same conditions.
--------------------------------------------------------------------------------------------------------------------------------------
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?
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?
--------------------------------------------------------------------------------------------------------------------------------------
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:
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.
last_name VARCHAR(255),
--------------------------------------------------------------------------------------------------------------------------------------
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:
FROM Customer
FROM customer
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
--------------------------------------------------------------------------------------------------------------------------------------
17. Which SQL query retrieves information about the primary key columns of the "customers table?
WHERE REFERENCED TABLE NAME - 'customers AND CONSTRAINT TYPE - PRIMARY KEY';
Ans.
c. SELECT COLUMN NAME, CONSTRAINT NAME
--------------------------------------------------------------------------------------------------------------------------------------
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.
name VARCHAR(50),
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
b. UPDATE orders o
WHERE c.email'[email protected]';
c. UPDATE orders
WHERE customer_id= (
SELECT id
FROM customers
d. UPDATE orders o
WHERE c.email'[email protected]'
Ans.
b. UPDATE orders o
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".
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.
GROUP BY customer_id
GROUP BY customer_id
Ans.
a. SELECT TOP 5 customer_id, COUNT(DISTINCT product_id) AS distinct_purchases
FROM order_details
GROUP BY customer_id
--------------------------------------------------------------------------------------------------------------------------------------
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
ALTER COLUMN;
--------------------------------------------------------------------------------------------------------------------------------------
21. You want to join two tables in a database and what is the correct syntax among the following for
the same?
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?
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.
FROM sales_data
GROUP BY 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.
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:
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?
a) UPDATE employees SET salary =salary* 1.10 WHERE department_id = (SELECT department_id
FROM employees 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");
--------------------------------------------------------------------------------------------------------------------------------------
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?
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
--------------------------------------------------------------------------------------------------------------------------------------
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 ?
FROM payroll_table
WHERE department = 'IT' AND location = 'xyz';
--------------------------------------------------------------------------------------------------------------------------------------
29. Want to do where working with software development models?
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.
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
(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
Answer: c) Design
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
34. Which of the following option are not a part of the Software Testing Life Cycle (STLC)?
A) Test Planning
C) Environment setup
D) Application development
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?
b) Virtual environment
c) Distributed environment
--------------------------------------------------------------------------------------------------------------------------------------
a) Code inspection
b) Coverage analysis
c) Usability assessment
d) Installation test
--------------------------------------------------------------------------------------------------------------------------------------
38. Which of the following environment are used to perform alpha testing?
b) Virtual environment
c) Distributed environment
--------------------------------------------------------------------------------------------------------------------------------------
39. An input field takes the year of birth between 1900 and 2004.
a) 190,020,042,005
b) 1900, 2004
c) 1,899,190,020,042,000
d) 189,919,001,901,200,000,000,000
moderator.
c) Authors are not present during inspections, whilst they are during
walkthroughs.
moderator.
a trained moderator.
--------------------------------------------------------------------------------------------------------------------------------------
41. which of the following would be a good starting point for troubleshooting if your router is not
translating.
--------------------------------------------------------------------------------------------------------------------------------------
42. The most important thing about early test design is that it.
--------------------------------------------------------------------------------------------------------------------------------------
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