Dump > Model_test

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Dump > Model_test as PDF for free.

More details

  • Words: 3,662
  • Pages: 12
model test 1. examine the data in the emlpoyees and departmenys table employees last_name department_id salary getz 10 3000 davis 20 1500 bill 20 2200 davis 30 5000 kochhar 5000 departments department_id department_name 10 sales 20 marketing 30 accounts 40 adminstration you want to retrieve all employees whether or not they have matching departments in the departments table. which query do you use? a. select last_name,department_name from employees,departments(+); b. select last_name,department_name from employees join departments(+); c. select last_name,department_name on(e.department_id=d.departments_id); d. select last_name,department_name from employees e, right outer join departments d on (e.department_id=d.department_id) e. select last_name,department_name from employees(+),departments on (e.department_id=d.department_id); f. select last_name,department_name from employees e left outer join departments d on (e.department_id=d.department_id); ans : 2. you need to give the manager role the ability to select from, insert into, and modify existing rows in the student_grades table. anyone given this managerrole should be able to pass privileges on to others. which statement accomplishes this ? a. grant b. grant c. grant d. grant e. grant option; f. grant option;

select, select, select, select, select,

insert, insert, insert, insert, insert,

update update modify update update

on on on on on

student_grades student_grades student_grades student_grades student_grades

to to to to to

manager role manager manager with grant option; manager with grant option; role manager with grant

select, insert, modify on student_grades to role manager with grant

ans : 3. which two statements about views are true ? (choose two) a. b. c. d. e.

a a a a a

view view view view view

can be created as read only. can be created as a join on two or more tables. cannot have an order by clause in the select statement. cannot be created with a group by clause in the select statement. must have aliases defined for the column names in the select statement.

ans : 4. which syntax turns an existing constraint on ? a. b. c. d. e. f.

alter alter alter alter alter alter

table table table table table table

table_name table_name table_name table_name table_name table_name

enable constraint_name; status = enable constraint constraint_name; enable constraint constraint_name; status = enable constraint constraint_name; turn on constraint constraint_name; turn on constraint constraint_name;

ans : 5. examine the std_id course_id start_date end_date

description of the students table : number(4) varchar2(10) date date

which two aggregate functions are valid on the start_date column ? (choose two) a. b. c. d. e. f.

sum(start_date) avg(start_date) count(start_date) avg(start_date, end_date) min(start_date) maximum(start_date)

ans : 6. the employee table has these columns : last_name varchar2(35) salary number(8, 2) commission_pct number(5, 2) you want to display the name and annual salary multiplied by the commission_pct for all employees. for records that have a null commission_pct, a zero must be displayed against the calculated column. which sql statement displays the desired results ? a. b. c. d.

select select select select

last_name, last_name, last_name, last_name,

(salary (salary (salary (salary

* * * *

12) 12) 12) 12)

* * * *

commission_pct from employees; ifnull(commission_pct, 0) from employees; nvl2(commission_pct, 0) from employees; nvl(commission_pct, 0) from employees;

ans : 7. 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. b. c. d. e.

alter alter alter alter alter

ans :

table table table table table

students students students students students

add primary key student_id; add constraint primary key (student_id); add constraint stud_id_pk primary key (student_id); add constraint stud_id_pk primary key (student_id); modify constraint stud_id_pk primary key (student_id);

8. which are datetime data types that can be used when specifying column definitions ? (choose whichever is applicable.) a. b. c. d. e.

timestamp interval month to day interval day to second interval year to month timestamp with database timezone

ans : 9. which sql statement defines the foreign key constraint on the deptno column of the emp table ? a. create table emp (empno number(4).ename varchar2(35), deptno number(7, null constraint emp_deptno_fk foreign key deptno references dept deptno); b. create table emp (empno number(4).ename varchar2(35), deptno number(7, constraint emp_deptno_fk references dept (deptno)); c. create table emp (empno number(4).ename varchar2(35), deptno number(7, null, constraint emp_deptno_fk references dept (deptno) foreign key (deptno)); d. create table emp (empno number(4).ename varchar2(35), deptno number(7, foreign key constraint emp deptno fk references dept (deptno));

2) not 2) 2) not 2)

ans : 10. which data dictionary table should you query to view the object privileges granted to the user on specific columns ? a. b. c. d.

user_tab_privs_made user_tab_privs user_col_privs_made user_col_privs

ans : 11. 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 chanded to display the desired results. d. the where clause should be changed to use an outer join to display the desired results. ans :

12. which /sql*plus feature can be used to replace values in the where clause ? a. b. c. d. e.

prompt variables instead-of variables substitution variables replacement variables this feature cannot be implemented through /sql*plus.

ans : 13. for which two constraints does the oracle server implicitly create a unique index ? (choose two.) a. b. c. d. e.

foreign key primary key not null check unique

ans : 14. which three select statements displays 2000 in the format "$2,000.00" ? (choose three.) a. b. c. d. e. f.

select select select select select select

to_char(2000, to_char(2000, to_char(2000, to_char(2000, to_char(2000, to_char(2000,

'$#,###.##') '$0,000.00') '$9,999.00') '$9,999.99') '$2,000.00') '$n,nnn.nn')

from from from from from from

dual dual dual dual dual dual

; ; ; ; ; ;

ans : 15. which /sql*plus feature can be used to replace values in the where clause ? a. b. c. d. e.

replacement variables instead-of variables prompt variables substitution variables this feature cannot be implemented through /sql*plus.

ans : 16. examine the sql statements that creates orders table : create table orders (ser_no number unique, order_id number, order_date date not null, status varchar2(10) check (status in ('credit', 'cash')), prod_id_number references products(product_id), ord_total number, primary key (order_id, order_date)); for which columns would an index be automatically created when you execute the above sql statement ? (choose two.) a. ser_no

b. c. d. e. f.

order_id status prod_id ord_total composite index on order_id and order_date

ans : 17. which two are true about aggregate functions ? (choose two.) a. you can use aggregate functions in any clause of a select statement. b. you can use aggregate functions only in the column list of the select clause and in the where clause of a select statement. c. you can mix single row columns with aggregate functions in the column list of a select statement by grouping on the single row columns. d. you can pass column names, expressions, constants, or functions as parameters to an aggregate function. e. you can use aggregate functions on a table, only by grouping the whole table as one single group. f. you cannot group the rows of a table by more than one column while using aggregate functions. ans : 18. which two statements about subqueries are true ? (choose two.) a. a single row subquery can retrieve data from only one table. b. a sql query statement cannot display data from table b that is referred to in its subquery, unless table b is included in the main query's from clause. c. a sql query statement can display data from table b that is referred to in its subquery, without including table b in its own from clause. d. a single row subquery can retrieve data from more than one table. e. a single row subquery cannot be used in a condition where the like operator is used for comparison. f. a multiple-row subquery cannot be used in a condition where the like operator is used for comparison. ans : 19. you added a phone_number column of number data type to an existing employees table. the employees table already contains records of 100 employees. now, you want to enter the phone numbers of each of the 100 employees into the table. some of the employees may not have a phone number available. which data manipulation operation do you perform ? a. b. c. d. e. f.

merge insert update add enter you cannot enter the phone numbers for the existing employee records.

ans : 20. 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. d. e. f.

you you one you

want all matched data from both tables. want all unmatched data from both tables. of the tables has more data than the other. want all matched and unmatched data from only one table.

ans : 21. which two statements accurately describe a role ? (choose two.) a. a role can be given to a maximum of 1000 users. b. a user can have access to a maximum of 10 roles. c. a role can have a maximum of 100 privileges contained in it. d. privileges are given to a role by using the create role statement. e. a role is a named group of related privileges that cen be granted to the user. f. a user can have access to several roles, and several users can be assigned the same role. ans : 22. what is necessary for your query on an existing view to execute successfully ? a. b. c. d.

the you the you

underlying tables must need select privileges underlying tables must need select privileges

have data. on the view. be in the same schema. only on the underlying tables.

ans : 23. evaluate these two sql statements : select last_name, salary, hire_date from employees order by salary desc ; select last_name, salary, hire_date from employees order by 2 desc ; what is true about them ? a. the two statements produce identical results. b. the second statement returns a syntax error. c. there is no need to specify desc because the results are stored in descending order by default. d. the two statements can be made to produce identical results by adding a column alias for the salary column in the second sql statement. ans : 24. from sql*plus, you issue this select statement : select * from order ; you use this statement to retrieve data from a data table for__________. (choose all that apply.) a. b. c. d. e.

updating viewing deleting inserting truncating

ans : 25. which four statements correctly describe functions that are available in sql ? (choose four.)

a. instr returns the numeric position of a named character. b. nvl2 returns the first non-null expression in the expression list. c. truncate rounds the column, expression, or value to n decimal places. d. decode translates an expression after comparing it to each search value. e. trim trims the heading of trailing characters (or both) from a character string. f. nvl compares two expressions and returns null if they are equal, or the first expression of they are not equal. g. nullif compares two expressions and returns null if they are equal, or the first expression if they are not equal. ans : 26. which two are attributes of /sql*plus ? (choose two.) a. b. c. d. e.

/sql*plus /sql*plus /sql*plus /sql*plus /sql*plus

commands cannot be abbreviated. commands are accesses from a browser. commands are used to manipulate data in tables. commands manipulate table definitions in the database. in the oracle proprietory interface for executing sql statements.

ans : 27. in which scenario would index be most useful ? a. b. c. d.

the the the the

indexed indexed indexed indexed

column is declared as not null. columns are used in the from clause. columns are part of an expression. column contains a wide range of values.

ans : 28. which sql statement generates the alias annual salary for the calculated column salary*12 ? a. b. c. d.

select select select select

ename, ename, ename, ename,

salary*12 salary*12 salary*12 salary*12

'annual salary' from employees ; "annual salary" from employees ; as annual salary from employees ; as initcap ("annual salary") from employees ;

ans : 29. which clause would you use in a select statement to limit the display to those employees whose salary is greater than 5000 ? a. b. c. d.

order by salary > 5000 group by salary > 5000 having salary > 5000 where salary > 5000

ans : 30. which operator can be used with a multiple-row subquery ? a. b. c. d.

is = between not in

e. like f. <> ans : 31. evaluate this sql statement : select e.employee_id, e.last_name, e.department_id, d.department_name from emp e, department d where e.department_id = d.department_id ; in the statement, which capabilities of a select statement are performed ? a. b. c. d.

projection, join, difference intersection, selection, join difference, projection, product projection, join, selection

ans : 32. which three statements correctly describe the functions and use of constraints ? (choose three.) a. b. c. d. e. f.

constraints constraints constraints constraints constraints constraints

provide data independence. make complex queries easy. enforce rules at the view level. enforce rules at the table level. prevent the deletion of a table if there are dependencies. prevent the deletion of an index if there are dependencies.

ans : 33. you define a multiple-row subquery in the where clause of an sql query with a comparison operator "=". what happens when the main query is executed ? a. the main query executes with the b. the main query executes with the c. the main query executes with all d. the main query fails because the comparison operator. e. you cannot define a multiple-row

first value returned by the subquery. last value returned by the subquery. the values returned by the subquery. multiple-row subquery cannot be used with the subquery in the where clause of a sql query.

ans : 34. what is true about joining tables through an equijoin ? a. you can join a maximum of two tables through an equijoin. b. you can join a maximum of two columns through an equijoin. c. you specify an equijoin condition in the select or from clauses of a select statement. d. to join two tables through an equijoin, the columns in the join condition must be primary key and foreign key columns. e. you can join n tables (all having single column primary keys) in a sql statement by specifying a minimum of n-1 join conditions. ans : 35. which clause should you use to exclude group results ? a. where b. having

c. restrict d. group by e. order by ans : 36. a subquery can be used to _________ . a. b. c. d.

create groups of data. sort data in a specific order. convert data to a different format. retrieve data based on an unknown condition.

ans : 37. which is an sql commad ? (choose all that apply.) a. insert b. update c. select d. describe e. delete f.rename ans : 38. which statement creates a new user ? a. b. c. d. e. f.

create create create create create create

user vim; or replace user vim; new user vim default user vim identified by ala; new user vim identified by ala; or replace user vim identified by ala;

ans : 39. which three are true regarding the use of outer joins ? (choose three.) a. you cannot use in operator in a condition that involves an outerjoin. b. you use (+) on both sides of the where condition to perform an outerjoin. c. you use (*) on both sides of the where condition to perform an outerjoin. d. you use an outerjoin to see only the rows that do not meet the join condition. e. in the where condition, you use (+) following the name of the column in the table without matching rows, to perform an outerjoin. f. you cannot link a condition that is involved in an outerjoin to another condition by using the or operator. ans : 40. evaluate this sql statement : select e.employee_id, e.last_name, e.department_id, d.department_name from emp e, department d where e.department_id = d.department_id ; in the statement, which capabilities of a select statement are performed ? a. projection, join, selection b. difference, projection, join c. selection, intersection, join

d. intersection, projection, join e. difference, projection, product ans : 41. you define a multiple-row subquery in the where clause of an sql query with a comparison operator "=". what happens when the main query is executed ? a. the main query executes with the b. the main query executes with the c. the main query executes with all d. the main query fails because the comparison operator. e. you cannot define a multiple-row

first value returned by the subquery. last value returned by the subquery. the values returned by the subquery. multiple-row subquery cannot be used with the subquery in the where clause of a sql query.

ans : 42. what is true about joining tables through an equijoin ? a. you can join a maximum of two tables through an equijoin. b. you can join a maximum of two columns through an equijoin. c. you specify an equijoin condition in the select of from clauses of a select statement. d. to join two tables through an equijoin, the columns in the join condition must be primary key and foreign key columns. e. you can join n tables (all having single column primary keys) in a sql statement by spedifying a maximum of n-1 join conditions. ans : 43. which clause should you use to exclude group results ? a. b. c. d. e.

where having restrict group by order by

ans : 44.

in which scenario would top n analysis be the best solution ?

a. you b. you c. you d. you number

want to identify want to find the want to identify want to rank the of products.

the most senior employee in the company. manager supervising the largest number of employees. the person who makes the highest salary for all employees. top three sales representatives who have sold the maximum

ans : 45. what is true about the with grant option clause ? a. b. c. d. e.

it it it it it

allows a grantee dba privileges. is required syntax for object privileges. allows privileges on specified columns of tables. is used to grant an object privilege on a foreign key column. allows the grantee to grant object privileges to other users and roles.

ans : 46. the dba issues this sql command : create user scott identified by tiger ; what privileges does the user scott have at this point ? a. b. c. d.

no privileges. only the select privilege. only the connect privilege. all the privileges of a default user.

ans : 47. which two statements complete a transaction ? (choose two.) a. b. c. d. e. f.

delete employees : describe employees ; rollback to savepoint c ; grant select on employees to scott alter table employees set unused column sal ; select max(sal) from employees where department_id 20 :

ans : 48. which statement describes the rowid data type ? a. b. c. d. e.

binary data up to 4 gigabytes. character data up to 4 gigabytes. raw binary data of variable length up to 2 gigabytes. binary data stored in an external file, up to 4 gigabytes. a hexadecimal string representing the unique address of a row in its table.

ans : 49. evaluate the sql statement : drop table dept ; which four statements are true of the sql statement ? (choose four.) a. b. c. d. e. f. g.

you all all all all all all

cannot roll back this statement. pending transactions are committed. views based on the dept table are deleted. indexes based on the dept table are dropped. data in the table is deleted, and the table structure is also deleted. data in the table is deleted, but the structure of the table is retained. synonyms based on the dept table are deleted.

ans : 50. which two statements are true about where and having clauses ? (choose two.) a. b. c. d. e. f.

a a a a a a

ans :

where clause can be used to restrict both rows and groups. where clause can be used to restrict rows only. having clause can be used to restrict both rows and groups. having clause can be used to restrict groups only. where clause cannot be used in a query of the query uses a having clause. having clause cannot be used in subqueries.

51. the employees table contains these columns : employee_id number(4) ename varchar2(25) job_id varchar2(10) which sql statement will return the ename, length of the ename, and the numeric position of the letter "a" in the ename column, for those employees whose ename ends with the letter "n" ? a. select ename, (ename, -1, 1) = b. select ename, (ename, -1, 1) = c. select ename, (ename, -1, 1) = d. select ename, (ename, -1, 1) =

length(ename), 'n' ; length(ename), 'n' ; length(ename), 'n' ; length(ename), 'n' ;

instr(ename, 'a') from employees where substr instr(ename, -1, 1) from employees where substr substr(ename, -1, 1) from employees where instr substr(ename, -1, 1) from employees where instr

ans : 52. top n analysis requires _________ and __________ . (choose two.) a. b. c. d. e.

the use of rowid a group by clasue an order by clause only an inline view an inline view and an outer query

ans :

*********************

Related Documents

Dump Truck.docx
May 2020 9
Itil Dump
December 2019 21
Dump A.docx
June 2020 2
Dump > Model_test
November 2019 13
Midi Dump
October 2019 17
Java Dump
November 2019 12