Oracle Database Quiz Questions

Course Name:Oracle
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:'AND' and 'OR' Operators
Current Quiz Count:30
Progress
0%
Q1
True / False

In Oracle, the AND operator is used to combine multiple conditions in a WHERE clause where all conditions must be true.

Q2
True / False

The OR operator in Oracle is used to combine multiple conditions in a WHERE clause where at least one condition must be true.

Q3
True / False

In Oracle, the AND operator has higher precedence than the OR operator.

Q4
True / False

In Oracle, you can use parentheses to change the order of evaluation of AND and OR operators in a WHERE clause.

Q5
True / False

The AND operator can be used to combine conditions in both WHERE and HAVING clauses in Oracle.

Q6
True / False

In Oracle, combining AND and OR operators without parentheses can lead to ambiguous and unexpected results.

Q7
True / False

In Oracle, the AND operator can be used within a JOIN condition to specify multiple join criteria.

Q8
True / False

The OR operator can be used in Oracle to check if a value is within a range of values without using BETWEEN.

Q9
True / False

In Oracle, the AND and OR operators can be used in a CASE statement to define complex conditions.

Q10
True / False

The Oracle Certified Professional (OCP) exam includes knowledge on using the AND and OR operators efficiently and understanding their impact on query performance and logic.

Q11
Single Choice

What is the purpose of the AND operator in Oracle SQL?

Q12
Single Choice

What is the purpose of the OR operator in Oracle SQL?

Q13
Single Choice

Consider the following Oracle SQL query:What does this query return?

SQL Code
SELECT * FROM employees WHERE department_id = 10 AND salary > 5000;
Q14
Single Choice

Consider the following Oracle SQL query:What does this query return?

SQL Code
SELECT * FROM orders WHERE order_date > '01-JAN-2023' OR order_status = 'Pending';
Q15
Single Choice

What will be the result of the following Oracle SQL query?

SQL Code
SELECT * FROM products WHERE category_id = 1 AND (price < 100 OR stock > 50);
Q16
Single Choice

Consider the following Oracle SQL query:How will this query behave if parentheses are not used?

SQL Code
SELECT * FROM customers WHERE city = 'New York' OR city = 'Los Angeles' AND orders > 10;
Q17
Single Choice

What happens when both AND and OR operators are used in an Oracle SQL query without parentheses?

Q18
Single Choice

Consider the following Oracle SQL query:What does this query return?

SQL Code
SELECT * FROM employees WHERE (department_id = 20 AND salary > 6000) OR (department_id = 10 AND salary < 4000);
Q19
Single Choice

How can the use of AND and OR operators affect query performance in Oracle?

Q20
Single Choice

In an Oracle certification exam, you encounter the following SQL statement:What does this query return?

SQL Code
SELECT product_id, product_name FROM products WHERE (category_id = 1 AND price > 50) OR (category_id = 2 AND price < 20);
Q21
Multiple Choice

Which SQL code snippet correctly uses the AND and OR operators to filter employees where the department is 'HR' and the salary is above 50000, or the department is 'IT' in Oracle?

SQL Code
SELECT *
FROM employees
WHERE department = 'HR' AND salary > 50000
OR department = 'IT';

SELECT *
FROM employees
WHERE (department = 'HR' AND salary > 50000)
OR department = 'IT';

SELECT employee_id, department, salary
FROM employees
WHERE department = 'HR' AND (salary > 50000 OR department = 'IT');
Q22
Multiple Choice

Which SQL code snippet demonstrates how to use the AND and OR operators to filter orders where the status is 'Shipped' and the amount is above 1000, or the customer is 'VIP' in Oracle?

SQL Code
SELECT *
FROM orders
WHERE status = 'Shipped' AND amount > 1000
OR customer = 'VIP';

SELECT *
FROM orders
WHERE (status = 'Shipped' AND amount > 1000)
OR customer = 'VIP';

SELECT order_id, status, amount
FROM orders
WHERE status = 'Shipped' AND (amount > 1000 OR customer = 'VIP');
Q23
Multiple Choice

Which SQL code snippet uses the AND and OR operators to filter products where the category is 'Electronics' and the price is between 100 and 500, or the stock is below 50 in Oracle?

SQL Code
SELECT *
FROM products
WHERE category = 'Electronics' AND price BETWEEN 100 AND 500
OR stock < 50;

SELECT *
FROM products
WHERE (category = 'Electronics' AND price BETWEEN 100 AND 500)
OR stock < 50;

SELECT product_id, category, price
FROM products
WHERE category = 'Electronics' AND (price BETWEEN 100 AND 500 OR stock < 50);
Q24
Multiple Choice

Which SQL code snippet demonstrates how to use the AND and OR operators to filter customers where the country is 'USA' and the age is above 30, or the membership is 'Gold' in Oracle?

SQL Code
SELECT *
FROM customers
WHERE country = 'USA' AND age > 30
OR membership = 'Gold';

SELECT *
FROM customers
WHERE (country = 'USA' AND age > 30)
OR membership = 'Gold';

SELECT customer_id, country, age
FROM customers
WHERE country = 'USA' AND (age > 30 OR membership = 'Gold');
Q25
Multiple Choice

Which SQL code snippet uses the AND and OR operators to filter sales records where the region is 'East' and the sales amount is above 5000, or the salesperson is 'John' in Oracle?

SQL Code
SELECT *
FROM sales
WHERE region = 'East' AND sales_amount > 5000
OR salesperson = 'John';

SELECT *
FROM sales
WHERE (region = 'East' AND sales_amount > 5000)
OR salesperson = 'John';

SELECT sale_id, region, sales_amount
FROM sales
WHERE region = 'East' AND (sales_amount > 5000 OR salesperson = 'John');
Q26
Multiple Choice

Which SQL code snippet demonstrates advanced use of the AND and OR operators to filter employees where the job title is 'Manager' and the department is 'Sales', or the hire date is before 2020 in Oracle?

SQL Code
SELECT *
FROM employees
WHERE job_title = 'Manager' AND department = 'Sales'
OR hire_date < TO_DATE('2020-01-01', 'YYYY-MM-DD');

SELECT *
FROM employees
WHERE (job_title = 'Manager' AND department = 'Sales')
OR hire_date < TO_DATE('2020-01-01', 'YYYY-MM-DD');

SELECT employee_id, job_title, department
FROM employees
WHERE job_title = 'Manager' AND (department = 'Sales' OR hire_date < TO_DATE('2020-01-01', 'YYYY-MM-DD'));
Q27
Multiple Choice

Which SQL code snippet uses the AND and OR operators to filter orders where the order date is after 2021 and the status is 'Completed', or the total is above 10000 in Oracle?

SQL Code
SELECT *
FROM orders
WHERE order_date > TO_DATE('2021-01-01', 'YYYY-MM-DD') AND status = 'Completed'
OR total > 10000;

SELECT *
FROM orders
WHERE (order_date > TO_DATE('2021-01-01', 'YYYY-MM-DD') AND status = 'Completed')
OR total > 10000;

SELECT order_id, order_date, status
FROM orders
WHERE order_date > TO_DATE('2021-01-01', 'YYYY-MM-DD') AND (status = 'Completed' OR total > 10000);
Q28
Multiple Choice

Which SQL code snippet demonstrates advanced use of the AND and OR operators to filter customers where the city is 'New York' and the age is below 40, or the account type is 'Premium' in Oracle?

SQL Code
SELECT *
FROM customers
WHERE city = 'New York' AND age < 40
OR account_type = 'Premium';

SELECT *
FROM customers
WHERE (city = 'New York' AND age < 40)
OR account_type = 'Premium';

SELECT customer_id, city, age
FROM customers
WHERE city = 'New York' AND (age < 40 OR account_type = 'Premium');
Q29
Multiple Choice

Which SQL code snippet uses the AND and OR operators to filter products where the brand is 'Apple' and the price is above 1000, or the warranty is '2 years' in Oracle?

SQL Code
SELECT *
FROM products
WHERE brand = 'Apple' AND price > 1000
OR warranty = '2 years';

SELECT *
FROM products
WHERE (brand = 'Apple' AND price > 1000)
OR warranty = '2 years';

SELECT product_id, brand, price
FROM products
WHERE brand = 'Apple' AND (price > 1000 OR warranty = '2 years');
Q30
Multiple Choice

Which SQL code snippet demonstrates the certification-level use of the AND and OR operators to filter orders where the shipping date is before 2022 and the destination is 'California', or the payment status is 'Pending' in Oracle?

SQL Code
SELECT *
FROM orders
WHERE shipping_date < TO_DATE('2022-01-01', 'YYYY-MM-DD') AND destination = 'California'
OR payment_status = 'Pending';

SELECT *
FROM orders
WHERE (shipping_date < TO_DATE('2022-01-01', 'YYYY-MM-DD') AND destination = 'California')
OR payment_status = 'Pending';

SELECT order_id, shipping_date, destination
FROM orders
WHERE shipping_date < TO_DATE('2022-01-01', 'YYYY-MM-DD') AND (destination = 'California' OR payment_status = 'Pending');