CC6001ES ADSD SQL Exam Model Paper 1 Answers
CC6001ES ADSD SQL Exam Model Paper 1 Answers
CC6001ES ADSD SQL Exam Model Paper 1 Answers
1. Look at the data in table PRODUCTS. Which SQL will list the items on the BL
shelves? (Show the result with the most available quantity at the top row.)
ERROR at line 1:
ORA-08002: sequence KEY_SEQ.CURRVAL is not yet defined
Which of the following statements does the developer need to run to fix this
condition?
a. High-cardinality columns
b. Online transaction processing (OLTP) applications
c. Full-table scan access
*d. Low- to medium-cardinality columns
a. SELECT clause
*b. WHERE clause
c. ORDER BY clause
d. None of the above
5. Consider the following SQL, and choose the most appropriate option.
SELECT COUNT(DISTINCT SUBSTR(first_name, 1,1))
FROM employees;
a. UPDATE ACCOUNTS
SET (LAST_UPDATED, UPDATE_USER) =
(SYSDATE, USER);
*b. UPDATE ACCOUNTS
SET LAST_UPDATED =
(SELECT SYSDATE FROM DUAL),
UPDATE_USER = (SELECT USER FROM DUAL);
*c. UPDATE ACCOUNTS
SET (LAST_UPDATED, UPDATE_USER) =
(SELECT SYSDATE, USER FROM DUAL);
d. UPDATE ACCOUNTS
SET LAST_UPDATED = SYSDATE
AND UPDATE_USER = USER;
7. Consider the following code segment. How many rows will be in the CARS
table after all these statements are executed?
SELECT COUNT(*) FROM CARS;
COUNT(*)
--------
30
SAVEPOINT A;
Savepoint creted.
SAVEPOINT A;
ROLLBACK TO SAVEPOINT A;
Rollback complete.
a. 28
*b. 29
c. 30
d. 32
8. Consider the following query:
SELECT deptno, ename, salary salary, average,
salary-average difference
FROM emp,
(SELECT deptno dno, AVG(salary) average FROM emp
GROUP BY deptno)
WHERE deptno = dno
ORDER BY 1, 2;
Which of the following statements is correct?
a. The query will fail because no alias name is provided for the subquery.
b. GROUP BY cannot be used inside a subquery.
c. The query will fail because a column selected in the subquery is
referenced outside the scope of the subquery.
*d. The query will work without errors.
10. Consider the following three SQL statements. Choose the most appropriate
option.
1. DELETE FROM CITY WHERE CNT_CODE = 1;
2. DELETE CITY WHERE CNT_CODE = 1;
3. DELETE (SELECT * FROM CITY WHERE CNT_CODE = 1);
a. Statements 1 and 2 will produce the same result; statement 3 will error
out.
b. Statements 1 and 2 will produce the same result; statement 3 will
produce a different result.
*c. Statements 1, 2, and 3 will produce the same result.
d. Statements 1, 2, and 3 will produce different results.
11. Consider the following two SQL statements, and choose the best option:
1. SELECT TO_DATE('30-SEP-07','DD-MM-YYYY') from dual;
2. SELECT TO_DATE('30-SEP-07','DD-MON-RRRR') from dual;
Which statement is true regarding the above query if one of the values generated
by the
subquery is NULL?
a. It produces an error
b. It executes but returns no rows.
*c. It generates output for NULL as well as the other values produced by
the subquery.
d. It ignores the NULL value and generates output for the other values
produced by the
subquery.
a. 16
b. 100
*c. 160
d. 200
e. 150
You want to retrieve all employees' last names, along with their managers' last
names and their department names. Which query would you use?
18. How many rows will be counted in the last SQL statement that follows?
SELECT COUNT(*) FROM emp;
120 returned
ROLLBACK;
a. 0
b. 121
*c. 124
d. 143
19. How will the results of the following two statements differ?
Statement 1:
SELECT MAX(longitude), MAX(latitude)
FROM zip_state_city;
Statement 2:
SELECT MAX(longitude), MAX(latitude)
FROM zip_state_city
GROUP BY state;
*a. One
b. The number of base tables in the view definition
c. The number of base tables minus one
d. None
22. Jim executes the following SQL statement. What will be the result?
DELETE salary, commission_pct
FROM employees
WHERE department_id = 30;
24. John is trying to find out the average salary of employees in each
department. He noticed that the SALARY column can have NULL values, and he
does not want the NULLs included when calculating the average. Identify the
correct SQL that will produce the desired results.
25. Read the following SQL carefully, and choose the appropriate option. The
JOB_ID column shows the various jobs.
SELECT MAX(COUNT(*))
FROM employees
GROUP BY job_id, department_id;