Sei sulla pagina 1di 20

http://quizoracle.blogspot.com/2010/11/final-exam-semester-1.html http://andu.3x.ro/oracle/sem2/oracle-s2.htm http://raspunsuri-oracle.blogspot.com/2009/01/raspunsuri-oracle-mid-exam-design.html http://andu.3x.ro/oracle/sem2/oracle-s2.1.

htm

1.

What will be the result of the SELECT statement and what will display?

SELECT last_name, salary, salary + 300 FROM employees; Mark for Review (1) Points Display the last name, salary and the results of adding 300 to each salary for all the employees (*) Modify the salary column by adding 300 and displaying the last name, salary and the new salary. Modify the salary column by adding 300 and only display the last name and the new salary. Display the last name, salary and the results of adding 300 to the salary of the first employee row Correct. 2. You need to display all the values in the EMAIL column that contains the underscore (_) character as part of that email address. The WHERE clause in your SELECT statement contains the LIKE operator. What must you include in the LIKE operator? Mark for Review (1) Points The ESCAPE option (\) and one or more percent signs (%) The (+) operator A percent sign (%) The ESCAPE option (\) (*) Correct.

3. You need to display all the employees whose last name starts with the letters Sm . Which WHERE clause should you use? Mark for Review (1) Points WHERE last_name LIKE 'Sm%' (*) WHERE last_name LIKE '%Sm' WHERE last_name LIKE '_Sm' WHERE last_name LIKE 'Sm_' Correct. 4. Evaluate this SELECT statement:

SELECT last_name, first_name, salary FROM employees; How will the heading for the SALARY column appear in the display by default in Oracle Application Express? Mark for Review (1) Points The heading will display with the first character capitalized and centered. The heading will display with the first character capitalized and left justified. The heading will display as uppercase and centered. (*) The heading will display as uppercase and left justified. Correct. 5. Evaluate this SELECT statement:

SELECT * FROM employees WHERE department_id IN(10, 20, 30) AND salary > 20000; Which values would cause the logical condition to return TRUE? Mark for Review (1) Points DEPARTMENT_ID = 10 and SALARY = 20000

DEPARTMENT_ID = 20 and SALARY = 20000 DEPARTMENT_ID = null and SALARY = 20001 DEPARTMENT_ID = 10 and SALARY = 20001 (*) Correct. 6. You need to display employees whose salary is in the range of 10000 through 25000 for employees in department 50 . What does the WHERE clause look like? Mark for Review (1) Points WHERE department_id < 50 AND salary BETWEEN 10000 AND 25000 WHERE department_id > 50 AND salary BETWEEN 10000 AND 25000 WHERE department_id = 50 AND salary BETWEEN 25001 AND 10001 WHERE department_id = 50 AND salary BETWEEN 25000 AND 10000 (*) Correct. 7. You need to combine the FIRST_NAME and LAST_NAME columns in the EMPLOYEES table and display the columns as a combined character string. Which operator should you use? Mark for Review (1) Points + | || (*) AND Correct.

8. for Review (1) Points

Where in a SQL statement can you not use arithmetic operators? Mark

SELECT FROM (*) WHERE NONE Correct. 9. for Review (1) Points Links rows of data together inside the database. Links two or more columns or literals to form a single output column (*) Is represented by the asterisk (*) symbol Separates columns. Correct. 10. Which comparison operator searches for a specified character pattern? Mark for Review (1) Points IN LIKE (*) BETWEEN...AND... IS NULL Correct. 11. Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10? Mark for Review (1) Points The Concatenation Operator does which of the following? Mark

WHERE (*) FROM SELECT IS Correct. 12. When using the LIKE condition to search for _ symbols, which character can you use as the default ESCAPE option? Mark for Review (1) Points % ^ & \ (*) Correct. 13. The EMPLOYEES table includes these columns:

EMPLOYEE_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(15) NOT NULL FIRST_NAME VARCHAR2(10) NOT NULL HIRE_DATE DATE NOT NULL You want to produce a report that provides the last names, first names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task? Mark for Review (1) Points SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00'; (*) SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '30-AUG-00' AND '01-MAR-00';

SELECT last_name, first_name, hire_date FROM employees GROUP BY hire_date >= '01-MAR-00' and hire_date <= '30- AUG-00'; SELECT last_name, first_name, hire_date FROM employees AND hire_date >= '01-MAR-00' and hire_date <= '30-AUG- 00';

Correct.

Section 15 (Answer all questions in this section) 14. You query the database with this SQL statement: SELECT * FROM students; Why would you use this statement? Mark for Review (1) Points To insert data To view data (*) To display the table structure To delete data Incorrect. See Section 15 Lesson 1. 15. Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL query? Mark for Review (1) Points AS (*) OR AND SUBSTITUTE

Correct. 16. (1) Points SEL * FR sky; (*) select star from sky; SELECT star FROM sky; SELECT * FROM sky; Correct. 17. If a SQL statement returns data from two or more tables, which SQL capability is being used? Mark for Review (1) Points Selection Projection Joining (*) Insertion Correct. 18. You want to create a list of all albums that have been produced by the company. The list should include the title of the album, the artist's name, and the date the album was released. The ALBUMS table includes the following columns: ALB_TITLE VARCHAR2(150) NOT NULL ALB_ARTIST VARCHAR2(150) NOT NULL ALB_DATE DATE NOT NULL Which statement can you use to retrieve the necessary information? (1) Points SELECT * FROM albums; Mark for Review Which SQL statement will return an error? Mark for Review

(*) SELECT alb_title, alb_artist, alb_dates FROM album; SELECT alb_title, alb_artist, alb_dates FROM albums; SELECT alb_title; alb_artist; alb_date FROM albums;

Correct. 19. Review (1) Points 6 8 (*) 10 13 Correct. 20. Which statement best describes how arithmetic expressions are Mark for Review Addition operations are handled before any other operations. Multiplication and subtraction operations are handled before any other operations. Multiplication and addition operations are handled before subtraction and division operations. Division and multiplication operations are handled before subtraction and addition operations. (*) In a SELECT clause, what is the result of 2 + 3 * 2? Mark for

handled? (1) Points

Correct. 21. Why would this table name NOT work in an Oracle database? this_year_end+next_year Mark for Review (1) Points Table names must begin with an alphabetic character Too long The Plus sign + is not allowed in object names (*) None of the above Incorrect. Refer to Section 11 Lesson 2. 22. The transformation from an ER diagram to a physical design involves changing terminology. Primary Unique Identifiers in the ER diagram become __________ and relationships become ____________. Mark for Review (1) Points Foreign keys, Primary keys Primary keys, Foreign keys (*) Foreign keys, mandatory business rules Unique Keys, Primary keys Correct 23. In an Oracle database, why would 1_TABLE not work as a table name? Mark for Review (1) Points The database does not understand all capital letters There is no problem here. You can create a table called 1_TABLE. Object names must not start with a number. They must begin with a letter (*) TABLE is a reserved word

Correct 24. An "Arc Implementation" can be done just like any other Relationship - you simply add the required Foreign Keys. True or False? Mark for Review (1) Points True False (*) Correct 25. A foreign key cannot refer to a primary key in the same table. True or False? Mark for Review (1) Points True False (*) Correct 26. The explanation below is a column integrity constraint:

A column must contain only values consistent with the defined data format of the column. True or False? Mark for Review (1) Points True (*) False Correct 27. Identify all of the incorrect statements that complete this sentence: A primary key is: (Choose three) Mark for Review (1) Points (Choose all correct answers) A single column that uniquely identifies each column in a table (*)

One or more columns in a table that uniquely identifies each row in that table A set of columns in one table that uniquely identifies each row in another table (*) Only one column that must be null (*) Correct 28. (1) Points Tables always containing text data. Tables always containing numeric data. Columns having Primary Keys, Foreign Keys, Unique Keys and Check constraints defined in the database. Tables having Primary Keys, Foreign Keys, Unique Keys and Check constraints defined in the database. (*) Correct 29. key. True or False? (1) Points A table must have at least one candidate key, as well as its primary Mark for Review True False (*) Correct 30. It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False? Mark for Review (1) Points True False (*) Entity integrity refers to Mark for Review

Correct 31. Which statement about the default sort order is true? (1) Points

Mark for Review

The lowest numeric values are displayed last. The earliest date values are displayed first. (*) Null values are displayed first. Character values are displayed in reverse alphabetical order. Correct. 32. for Review (1) Points True (*) False Correct. 33. for Review (1) Points OR (*) AND NOT BOTH Correct. 34. for Review (1) Points "=)" Which comparison condition means Less Than or Equal To"? Mark Which logical operator returns TRUE if either condition is true? Mark The ORDER BY clause always comes last. True or False? Mark

"+<" ">=" "<=" (*) Correct. 35. Which clause would you include in a SELECT statement to sort the rows returned by the LAST_NAME column? Mark for Review (1) Points ORDER BY (*) WHERE FROM HAVING Correct. 36. Review (1) Points The order of operator precedence is AND, OR, and NOT. The order of operator precedence is AND, NOT, and OR. The order of operator precedence is NOT, OR, and AND. The order of operator precedence is NOT, AND, and OR. (*) Correct. 37. The EMPLOYEES table contains these columns: Which statement about the logical operators is true? Mark for

EMPLOYEE_ID NUMBER(9) PK

LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER(9) Compare these two SQL statements: ; 1. SELECT DISTINCT department_id DEPT, last_name, first_name FROM employees ORDER BY department_id; 2. SELECT department_id DEPT, last_name, first_name FROM employees ORDER BY DEPT; How will the results differ? Mark for Review (1) Points One of the statements will return a syntax error. One of the statements will eliminate all duplicate DEPARTMENT_ID values. There is no difference in the result between the two statements. (*) The statements will sort on different column values. Incorrect! See Section 17 Lesson 3. 38. Evaluate this SQL statement:

SELECT e.employee_id, e.last_name, e.first_name, m.manager_id FROM employees e, employees m ORDER BY e.last_name, e.first_name WHERE e.employee_id = m.manager_id; This statement fails when executed. Which change will correct the problem? Review (1) Points Reorder the clauses in the query. (*) Remove the table aliases in the WHERE clause. Remove the table aliases in the ORDER BY clause. Include a HAVING clause. Mark for

Correct. 39. The PLAYERS table contains these columns:

PLAYERS TABLE: LAST_NAME VARCHAR2 (20) FIRST_NAME VARCHAR2 (20) SALARY NUMBER(8,2) TEAM_ID NUMBER(4) MANAGER_ID NUMBER(9) POSITION_ID NUMBER(4) You must display the player name, team id, and salary for players whose salary is in the range from 25000 through 100000 and whose team id is in the range of 1200 through 1500. The results must be sorted by team id from lowest to highest and then further sorted by salary from highest to lowest. Which statement should you use to display the desired result? Mark for Review (1) Points SELECT last_name, first_name, team_id, salary FROM players WHERE (salary > 25000 OR salary < 100000) AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id, salary; SELECT last_name, first_name, team_id, salary FROM players WHERE salary BETWEEN 25000 AND 100000 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id, salary DESC; (*) SELECT last_name, first_name, team_id, salary FROM players WHERE salary > 24999.99 AND salary < 100000 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id ASC, salary DESC; SELECT last_name, first_name, team_id, salary FROM players WHERE salary BETWEEN 24999.99 AND 100000.01 AND team_id BETWEEN 1200 AND 1500 ORDER BY team_id DESC, salary DESC;

Correct. 40. Evaluate this SELECT statement:

SELECT * FROM employees WHERE department_id = 34 OR department_id = 45 OR department_id = 67; Which operator is the equivalent of the OR conditions used in this SELECT statement? Mark for Review (1) Points IN (*) AND LIKE BETWEEN... AND ... Correct. What value will the following SQL statement return?

41.

SELECT employee_id FROM employees WHERE employee_id BETWEEN 100 AND 150 OR employee_id IN(119, 175, 205) AND (employee_id BETWEEN 150 AND 200); Mark for Review (1) Points 19 No rows will be returned 100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*) 200, 201, 202, 203, 204, 205, 206 Correct. 42. You query the database with this SQL statement:

SELECT price FROM products WHERE price IN(1, 25, 50, 250) AND (price BETWEEN 25 AND 40 OR price > 50); Which two values could the statement return? (Choose two.) (1) Points (Choose all correct answers) 1 50 25 (*) 10 250 (*) Correct. 43. Evaluate this SELECT statement: Mark for Review

SELECT employee_id, last_name, first_name, salary Yearly Salary' FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3; Which clause contains an error? (1) Points 'Yearly Salary' (*) FROM employees WHERE salary IS NOT NULL ORDER BY last_name, 3; Correct. 44. Evaluate this SELECT statement: Mark for Review SELECT employee_id, last_name, first_name, salary

SELECT last_name, first_name, department_id, manager_id

FROM employees; You need to sort data by manager id values and then alphabetically by employee last name and first name values. Which ORDER BY clause could you use? Mark for Review (1) Points ORDER BY department_id, last_name ORDER BY manager_id, last_name, first_name (*) ORDER BY last_name, first_name, manager_id ORDER BY manager_id, first_name, last_name Correct. 45. Evaluate this SELECT statement:

SELECT first_name, last_name, email FROM employees ORDER BY last_name; Which statement is true? (1) Points Mark for Review The rows will not be sorted. The rows will be sorted alphabetically by the LAST_NAME values. (*) The rows will be sorted in reverse alphabetical order by the LAST_NAME values. The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_NAME values Correct.

Section 12 (Answer all questions in this section) 46. for Review (1) Points What command will return data from the database to you? Mark

FETCH GET SELECT (*) RETURN Correct. 47. What command can be used to create a new row in a table in the Mark for Review CREATE NEW ADD INSERT (*) Correct. 48. subset of the data. (1) Points The _______ clause can be added to a SELECT statement to return a Mark for Review ANYWHERE WHICH WHERE (*) EVERY Correct. 49. Once you have created a table, it is not possible to alter the definition of it. If you need to add a new column you must delete the table definition and create a new, correct table. True or False? Mark for Review (1) Points

database? (1) Points

True False (*) Correct. 50. ID Name Cole Bee Zoe Twee Sandra Lee The f_customers table contains the following data: Address City State Zip 123 Main Street Orlando FL 32838 1009 Oliver Avenue Boston MA 02116 22 Main Street Tampa FL 32444

1 2 3

If you run the following statement: DELETE FROM F_CUSTOMERS WHERE ID <= 2; How many rows will be left in the table? (1) Points 0 3 1 (*) 2 Correct. Mark for Review

Potrebbero piacerti anche