aiotestking uk

1Z0-051 Exam Questions - Online Test


1Z0-051 Premium VCE File

Learn More 100% Pass Guarantee - Dumps Verified - Instant Download
150 Lectures, 20 Hours

Q1. - (Topic 1) 

Evaluate the following SQL statement: 

SQL> SELECT cust_id. cust_last_name FROM customers WHERE cust_credit_limit IN (select cust_credit_limit FROM customers WHERE cust_city='Singapore'): 

Which statement is true regarding the above query if one of the values generated by the sub query 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 sub query. 

D. It ignores the NULL value and generates output for the other values produced by the sub query. 

Answer:

Q2. - (Topic 1) 

Exhibit contains the structure of PRODUCTS table: 

Evaluate the following query: 

What would be the outcome of executing the above SQL statement? 

A. It produces an error 

B. It shows the names of products whose list price is the second highest in the table. 

C. It shown the names of all products whose list price is less than the maximum list price 

D. It shows the names of all products in the table 

Answer:

Q3. - (Topic 1) 

Examine these statements: 

CREATE ROLE registrar; 

GRANT UPDATE ON student_grades TO registrar; 

GRANT registrar to user1, user2, user3; 

What does this set of SQL statements do? 

A. The set of statements contains an error and does not work. 

B. It creates a role called REGISTRAR, adds the MODIFY privilege on the STUDENT_GRADES object to the role, and gives the REGISTRAR role to three users. 

C. It creates a role called REGISTRAR, adds the UPDATE privilege on the STUDENT_GRADES object to the role, and gives the REGISTRAR role to three users. 

D. It creates a role called REGISTRAR, adds the UPDATE privilege on the STUDENT_GRADES object to the role, and creates three users with the role. 

E. It creates a role called REGISTRAR, adds the UPDATE privilege on three users, and gives the REGISTRAR role to the STUDENT_GRADES object. 

F. It creates a role called STUDENT_GRADES, adds the UPDATE privilege on three users, and gives the UPDATE role to the registrar. 

Answer:

Explanation: the statement will create a role call REGISTRAR, grant UPDATE on student_grades to registrar, grant the role to user1,user2 and user3. 

Incorrect Answer: Athe statement does not contain error Bthere is no MODIFY privilege Dstatement does not create 3 users with the role Eprivilege is grant to role then grant to user Fprivilege is grant to role then grant to user 

Q4. - (Topic 2) 

The STUDENT_GRADES table has these columns: 

STUDENT_ID NUMBER(12) 

SEMESTER_END DATE 

GPA NUMBER(4,3) 

Which statement finds the highest grade point average (GPA) per semester? 

A. SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL; 

B. SELECT (gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL; 

C. SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL GROUP BY semester_end; 

D. SELECT MAX(gpa) GROUP BY semester_end WHERE gpa IS NOT NULL FROM student_grades; 

E. SELECT MAX(gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL; 

Answer:

Explanation: Explanation: For highest gpa value MAX function is needed, for result with per semester GROUP BY clause is needed 

Incorrect Answer: Aper semester condition is not included Bresult would not display the highest gpa value Dinvalid syntax error Einvalid syntax error Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 5-7 

Q5. - (Topic 1) 

You work as a database administrator at ABC.com. You study the exhibit carefully. Exhibit: 

Evaluate the following query: Exhibit: 

The above query produces an error on execution. What is the reason for the error? 

A. An alias cannot be used in an expression 

B. The alias MIDPOINT should be enclosed within double quotation marks for the CUST_CREDIT_LIMIT/2 expression 

C. The MIDPOINT +100 expression gives an error because CUST_CREDIT_LIMIT contains NULL values 

D. The alias NAME should not be enclosed within double quotation marks 

Answer:

Q6. - (Topic 1) 

Evaluate the following SQL statements: Exhibit: 

Which is the correct output of the above query? 

A. +00-300, +54-02,+00 11:12:10.123457 

B. +00-300,+00-650,+00 11:12:10.123457 

C. +25-00, +54-02, +00 11:12:10.123457 

D. +25-00,+00-650,+00 11:12:10.123457 

Answer:

Q7. - (Topic 1) 

See the Exhibit and Examine the structure of the CUSTOMERS table: 

Using the CUSTOMERS table, you need to generate a report that shows an increase in the credit limit by 15% for all customers. Customers whose credit limit has not been entered should have the message "Not Available" displayed. 

Which SQL statement would produce the required result? 

A. SELECT NVL(cust_credit_limit,'Not Available')*.15 "NEW CREDIT" FROM customers; 

B. SELECT NVL(cust_credit_limit*.15,'Not Available') "NEW CREDIT" FROM customers; 

C. SELECT TO_CHAR(NVL(cust_credit_limit*.15,'Not Available')) "NEW CREDIT" FROM customers; 

D. SELECT NVL(TO_CHAR(cust_credit_limit*.15),'Not Available') "NEW CREDIT" FROM customers; 

Answer:

Explanation: 

NVL Function 

Converts a null value to an actual value: 

Data types that can be used are date, character, and number. 

Data types must match: 

– 

NVL(commission_pct,0) 

– 

NVL(hire_date,'01-JAN-97') 

– 

NVL(job_id,'No Job Yet') 

Q8. - (Topic 1) 

Evaluate the following two queries: Exhibit: 

Exhibit: 

Which statement is true regarding the above two queries? 

A. Performance would improve in query 2 only if there are null values in the CUST_CREDIT_LIMIT column 

B. Performance would degrade in query 2 

C. There would be no change in performance 

D. Performance would improve in query 2 

Answer:

Explanation: 

Note: The IN operator is internally evaluated by the Oracle server as a set of OR conditions, such as a=value1 or a=value2 or a=value3. Therefore, using the IN operator 

has no performance benefits and is used only for logical simplicity. 

Q9. - (Topic 1) 

The CUSTOMERS table has the following structure: Exhibit: 

You need to write a query that does the following task: 

Display the first name and tax amount of the customers. Tax is 5% of their credit limit 

Only those customers whose income level has a value should be considered 

Customers whose tax amount is null should not be considered 

Which statement accomplishes all the required tasks? 

A. 

SELECT cust_first_name, cust_credit_limit * .05 AS TAX_AMOUNT FROM customers WHERE cust_income_level IS NOT NULL AND tax_amount IS NOT NULL; 

B. 

SELECT cust_first_name, cust_credit_limit * .05 AS TAX_AMOUNT FROM customers WHERE cust_income_level IS NOT NULL AND cust_credit_limit IS NOT NULL; 

C. 

SELECT cust_first_name, cust_credit_limit * .05 AS TAX_AMOUNT FROM customers WHERE cust_income_level <> NULL AND tax_amount <> NULL; 

D. 

SELECT cust_first_name, cust_credit_limit * .05 AS TAX_AMOUNT FROM customers WHERE (cust_income_level,tax_amount) IS NOT NULL; 

Answer:

Q10. - (Topic 2) 

Which constraint can be defined only at the column level? 

A. UNIQUE 

B. NOT NULL 

C. CHECK 

D. PRIMARY KEY 

E. FOREIGN KEY 

Answer:

Explanation: 

The NOT NULL constraint can be defined only at the column level. It enforces that a value must be defined for this column such that the column may not be NULL for any row. 

Incorrect Answers A:The UNIQUE constraint enforces uniqueness on values in the constrained column. It can be defined not only at the column level. C:The CHECK constraint enforces that values added to the constrained column must be present in a static list of values permitted for the column. 

D:The PRIMARY KEY constraint stipulates that values in the constrained column(s) must be unique and not NULL. If the primary key applies to multiple columns, then the combination of values in the columns must be unique and not NULL. E:The FOREIGN KEY constraint enforces that only values in the primary key of a parent table may be included as values in the constrained column(s) of the child table. 

OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 227-232 Chapter 5: Creating Oracle Database Objects