Sunteți pe pagina 1din 5

Answer following Questions 1. Which line contains error in following statement. a. select deptno,avg(sal) b. from emp c.

where avg(sal) > 2000 group by deptno; d. No Errors 2. Which line contains error in the following statement. a. insert into dept b. values (50,sports,blore) c. where deptno=50; d. no errors 3. What does the following SQL statement do? SELECT deptno,MAX(avg(sal)) FROM emp GROUP BY deptno; a. error message. b. it calculates the maximum average salaries of all the departments c. it returns department with maximum average salary d. none of the above 4. In which case would you use a FULL OUTER JOIN? a. Both tables have NULL values. b. You want all unmatched data from one table. c. You want all matched data from both tables. d. You want all matched and unmatched data from both tables. 5. Which statement is used for altering view a. CREATE OR REPLACE VIEW <view_name> b. ALTER VIEW <view_name> c. MODIFY VIEW <view_name> d. None. 6. Output of select ename,sal from emp where sal > min(sal) is a. Employees with sal greater than minimum sal is displayed. b. Error c. Employees with min(sal) greater than sal with be displayed d. None. 7. select * from emp where rownum>5 returns a. All rows from 5th row will be displayed b. All rows from 6th row will be displayed c. no rows selected d. none of the above 8. The EMP table contains these columns: LAST NAME VARCHAR2(25) SALARY NUMBER(6,2) DEPARTMENT_ID NUMBER(6) You need to display the employees who have not been assigned to any department. You write the SELECT statement: SELECT LAST_NAME, SALARY, DEPARTMENT_ID FROM EMP WHERE DEPARTMENT_ID = NULL;

What is true about this SQL statement? A. The SQL statement displays the desired results. B. The column in the WHERE clause should be changed to display the desired results. C. The operator in the WHERE clause should be changed to display the desired results. D. The WHERE clause should be changed to use an outer join to display the desired results. 9. Which data dictionary table should you query to view the object privileges granted to the user on specific columns? A. USER_TAB_PRIVS_MADE B. USER_TAB_PRIVS C. USER_COL_PRIVS_MADE D. USER_COL_PRIVS 10. Which clause is used for manual locking a. update for b. for update c. lock d. none of the above 11. Any value added to NULL results in a. the value itself. b. 0 c. NULL d. Unpredictable 12. Which query is evaluated once per row processed by the parent statement a. SUBQUERY b. CORRELATED c. FOR EACH ROW d. NONE OF THE ABOVE 13. You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task? A. ALTER TABLE students ADD PRIMARY KEY student_id; B. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id); C. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id; D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id); E. ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id); 14. Which SELECT statement will the result 'ello world' from the string 'Hello World'? A. SELECT SUBSTR( 'Hello World',1) FROM dual; B. SELECT INITCAP(TRIM ('Hello World', 1,1)) FROM dual; C. SELECT LOWER(SUBSTR('Hello World', 1, 1) FROM dual; D. SELECT LOWER(SUBSTR('Hello World', 2, 1) FROM dual; E. SELECT LOWER(TRIM ('H' FROM 'Hello World')) FROM dual;

15. Which operator can be used with a multiple-row subquery? A. = B. LIKE C. BETWEEN D. NOT IN E. IS PL/SQL Questions 1. Which type of package construct must be declared both within the package specification and package body? A. All package variables. B. Boolean variables. C. Private procedures and functions. D. Public procedures and functions. 2. Why do stored procedures and functions improve performance? (Chose two) A. They reduce network round trips. B. They postpone PL/SQL parsing until run time. C. They allow the application to perform high speed processing locally. D. They reduce the number of calls to the database and decrease network traffic by bundling commands. E. They reduce the number of calls to the database and decrease network traffic by using the local PL/SQL engine. 3. When creating store procedures and functions which construct allows you to transfer values to and from the calling environment? A. Local variables. B. Formal arguments. C. Boolean variables. D. Substitution variables. 4. Which type of argument passes a value from a calling environment? A. VARCHER2. B. BOOLEAN. C. OUT. D. IN. 5. You need to create a trigger on the EMP table that monitors every row that is changed and places this information into the AUDIT_TABLE. Which type of trigger do you create? A. Statement-level trigger on the EMP table. B. For each row trigger on the EMP table. C. Statement-level trigger on the AUDIT_TABLE table. D. For each row statement level trigger on the EMP table. E. For each row trigger on the AUDIT_TABLE table. 6. Under which situation do you create a server side procedure?

A. When the procedure contains no SQL statements. B. When the procedure contains no PL/SQL commands. C. When the procedure needs to be used by many client applications accessing several remote databases. D. When the procedure needs to be used by many users accessing the same schema objects on a local database. 7. CREATE OR REPLACE TRIGGER update_emp AFTER UPDATE ON emp BEGIN INSERT INTO audit_table (who, audited) VALUES(USER, SYSDATE); END; You issue an update command on the EMP table that results in changing ten rows. How many rows are inserted into the AUDIT_TABLE? A. 1 B. 10 C. none D. Value equal to the number of rows in the emp table 8. Which two statements about packages are true? (Choose two) A. Packages can be nested. B. You can pass parameters to packages. C. A package is loaded into memory each time it is invoked. D. The contents of packages can be shared by many applications. E. You can achieve information hiding by making package constructs private. 9. Which two programming constructs can be grouped within a package? (Choose two) A. Cursor B. Constant C. Trigger D. Sequence E. View 10. CREATE OR REPLACE PRODECURE add_dept (p_dept_name VARCHAR2 DEFAULT 'placeholder', p_location VARCHAR2 DEFAULT 'Boston') IS BEGIN INSERT INTO departments VALUES (dept_id_seq.NEXTVAL, p_dept_name, p_location); END add_dept; / Which three are valid calls to the add_dep procedure? (Choose three) A. add_dept; B. add_dept('Accounting');

C. add_dept(, 'New York'); D. add_dept(p_location=>'New York'); E. add_dept(50); 11. You need to create a trigger on the EMP table that monitors every row that is changed and places this information into the AUDIT_TABLE. What type of trigger do you create? A. FOR EACH ROW trigger on the EMP table. B. Statement-level trigger on the EMP table. C. FOR EACH ROW trigger on the AUDIT_TABLE table. D. Statement-level trigger on the AUDIT_TABLE table. E. FOR EACH ROW statement-level trigger on the EMP table. 12. What part of a database trigger determines the number of times the trigger body executes? A. Trigger type B. Trigger body C. Trigger event D. Trigger timing 13. The command used to open a CURSOR FOR loop is A. open B. fetch C. %isopen D. none of the above 14. which line consists of error a. create procedure insert_dept (dno number(2),dname varchar2,loc varchar2) is b. begin c. insert into dept values(dno,dname,loc); d. commit; e. end; f. no errors 15. Which statement is true among following a. triggers can be written for select statement also. b. triggers cannot contain transaction commands. c. triggers can be called from other subprograms d. triggers can contain both before and after timing.