vineri, 16 decembrie 2011

Final Exam Sem I Oracle Answers

Section 12

(Answer all questions in this section)

1. The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN
SALARY is a valid statement. True or False?

Mark for Review
(1) Points

True



False (*)



Correct.

2. The f_customers table contains the following data:
ID Name
Address
City
State Zip
1  Cole Bee 123 Main Street
Orlando FL 32838
2  Zoe Twee 1009 Oliver Avenue Boston MA 02116
3 Sandra Lee 22 Main Street
Tampa FL 32444

If you run the following statement:
DELETE FROM F_CUSTOMERS WHERE ID <= 2;

How many rows will be left in the table?

Mark for Review
(1) Points

0

3

1 (*)

2


Correct.

3. What command will return data from the database to you?

Mark for Review
(1) Points

FETCH

GET

SELECT (*)

RETURN


Correct.

4. The _______ clause can be added to a SELECT statement to return a
subset of the data.

Mark for Review
(1) Points

ANYWHERE

WHICH

WHERE (*)

EVERY

Correct.

5. The DESCRIBE command returns all rows from a table. True or
False?

Mark for Review

(1) Points

True

False (*)

Correct.

Section 15

(Answer all questions in this section)

6. In a SELECT clause, what is the result of 2 + 3 * 2?

Mark for Review
(1) Points

6

8 (*)

10

13

Correct.

7. 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.

8. 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



Correct.

9. What would you use in the SELECT clause to return all the columns in
the table?

Mark for Review
(1) Points

An asterisk (*) (*)
A minus sign (-)
A plus sign (+)
The ALL keyword

Correct.

10.Which statement best describes how arithmetic expressions are
handled?

Mark for Review
(1) Points

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. (*)

Correct.

Section 15

(Answer all questions in this section)

11.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?

Mark for Review
(1) Points

SELECT *

FROM albums;

(*)

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.

12.The EMPLOYEES table contains these columns:

SALARY NUMBER(7,2)
BONUS NUMBER(7,2)
COMMISSION_PCT NUMBER(2,2)

All three columns contain values greater than zero. There is one row
of data in the table and the values are as follows:

Salary = 500, Bonus = 50, Commission_pct = .5

Evaluate these two SQL statements:

1.
SELECT salary + bonus + commission_pct * salary - bonus AS
income
FROM employees;

2.

Mark for Review
(1) Points

SELECT (salary + bonus ) + commission_pct * (salary - bonus)
income
FROM employees;

What will be the result?

Statement 1 will return a higher value than statement 2.

Statement 2 will return a higher value than statement 1. (*)

Statement 1 will display a different column heading.

One of the statements will NOT execute.

Correct.

Section 16

(Answer all questions in this section)

13.You need write a SELECT statement that should only return rows
that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which
operator should you use in the WHERE clause to compare the
DEPARTMENT_ID column to this specific list of values?

Mark for Review
(1) Points

=

!=

IN (*)

BETWEEN..AND..


Correct.

14.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.

15.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.

16.Which of the following commands will display the last name
concatenated with the job ID from the employees table, separated by
a comma and space, and label the resulting column "Employee and
Title"?

SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM

employees;
SELECT last_name||', '|| job_id "Employee and Title" FROM

employees; (*)
SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM

emp;
SELECT last_name||","|| job_id "Employee and Title" FROM

employees;

Mark for Review
(1) Points

Correct.

17.You need to display all the employees whose last name starts with the
letters Sm . Which WHERE clause should you use?

WHERE last_name LIKE 'Sm%' (*)

WHERE last_name LIKE '%Sm'

WHERE last_name LIKE '_Sm'

WHERE last_name LIKE 'Sm_'

Mark for Review
(1) Points

Correct.

18.You want to create a report that displays all employees who were
hired before January 1, 2000 and whose annual salaries are greater
than 50000.

The EMPLOYEES table contains these columns:

EMPLOYEE_ID VARCHAR2(5) PRIMARY KEY
LAST_NAME VARCHAR2(35)
HIREDATE DATE
DEPARTMENT_ID NUMBER(4)

The SALARY table contains these columns:

SALARYID VARCHAR2(5) PRIMARY KEY
SALARY NUMBER(5, 2)
EMPLOYEE_ID VARCHAR2(5) FOREIGN KEY

Which query should you issue?

SELECT last_name, hiredate, salary

FROM employees NATURAL JOIN salary USING employee_id
WHERE hiredate < 01-jan-00 AND salary > 50000;
SELECT last_name, hiredate, salary

FROM employees JOIN salary
ON employee_id = employee_id
WHERE hiredate < '01-jan-00' AND salary > 50000;
SELECT last_name, hiredate, salary

FROM employees NATURAL JOIN salary
WHERE hiredate < '01-jan-00' AND salary > 50000;

(*)

Mark for Review
(1) Points

SELECT last_name, hiredate, salary

FROM employees (+) salary
WHERE hiredate < '01-jan-00' AND salary > 50000;

Correct.

19.The Concatenation Operator does which of the following?

Mark 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.

20.You need to display all the rows in the EMPLOYEES table that contain
a null value in the DEPARTMENT_ID column. Which comparison
operator should you use?

"= NULL"

NULL!

ISNULL

IS NULL (*)

Mark for Review
(1) Points

Correct.



Section 16

(Answer all questions in this section)

21.Which of the following elements cannot be included in a WHERE
clause?

Mark for Review
(1) Points

A column alias (*)

A column name

A comparison condition

A constant

Correct.

22.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

WHERE (*)

FROM

SELECT

IS

Correct.

23.Which operator is used to combine columns of character strings to
other columns?

Mark for Review
(1) Points

*

/

+

|| (*)

Correct.

24.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.

25.Which comparison condition would you use to select rows that match
a character pattern?

Mark for Review
(1) Points

IN

LIKE (*)

ALMOST

SIMILAR

Correct.

Section 17

(Answer all questions in this section)

26.Evaluate this SELECT statement:

SELECT last_name, first_name, salary
FROM employees;

How will the results of this query be sorted?

Mark for Review
(1) Points

The database will display the rows in whatever order it finds it in
  database, so no particular order. (*)
the
The results will be sorted ascending by the LAST_NAME column

only.
The results will be sorted ascending by LAST_NAME and

FIRST_NAME only.
The results will be sorted ascending by LAST_NAME,

FIRST_NAME, and SALARY.

Correct.

27.Evaluate this SELECT statement:

SELECT first_name, last_name, email
FROM employees
ORDER BY last_name;

Which statement is true?

Mark for Review
(1) Points

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.

28.You need to create a report to display all employees that were hired
on or after January 1, 1996. The data should display in this format:
Employee
Start Date and Salary
14837 - Smith
10-MAY-92 / 5000

Which SELECT statement could you use?

Mark for Review
(1) Points

SELECT employee_id || - || last_name "Employee",
  hire_date || / || salary "Start Date and Salary
FROM employees
WHERE hire_date <= '01-JAN-96';
SELECT employee_id ||' '|| last_name "Employee",
  hire_date ||' '|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= 01-JAN-96';
SELECT employee_id ||'"- "|| last_name "Employee",
  hire_date ||" / "|| salary Start Date and Salary"

FROM employees
WHERE hire_date <= '01-JAN-96';
SELECT employee_id ||' - '|| last_name 'Employee',
  hire_date ||' / '|| salary 'Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';
SELECT employee_id ||' - '|| last_name "Employee",
  hire_date ||' / '|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';
(*)

Correct.

29.Which SELECT statement should you use to limit the display of
product information to those products with a price of less than 50?

SELECT product_id, product_name

FROM products
WHERE price < 50;
(*)

SELECT product_id, product_name

FROM products
HAVING price < 50;
SELECT product_id, product_name

FROM products
WHERE price <= 50;
SELECT product_id, product_name

FROM products
GROUP BY price < 50;
SELECT product_id, product_name

FROM products
WHERE price < 50.00
GROUP BY price;

Mark for Review
(1) Points

Correct.

30.What value will the following SQL statement return?

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);

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

Mark for Review
(1) Points

Correct.


Section 17

(Answer all questions in this section)

31.Evaluate this SQL statement:

SELECT product_id, product_name, price
FROM products
ORDER BY product_name, price;

What occurs when the statement is executed?

Mark for Review
(1) Points

The results are sorted numerically only.
The results are sorted alphabetically only.
The results are sorted numerically and then alphabetically.
The results are sorted alphabetically and then numerically. (*)

Correct.

32.Which of the following best describes the meaning of the LIKE
operator?

Mark for Review
(1) Points

Display rows based on a range of values.
To test for values in a list.
Match a character pattern. (*)
To find Null values.

Correct.

33.Which statement about the ORDER BY clause is true?

Mark for Review
(1) Points

You can use a column alias in the ORDER BY clause. (*)
The default sort order of the ORDER BY clause is descending.
The ORDER BY clause can only contain columns that are
included in the SELECT list.
The ORDER BY clause should immediately precede the FROM
clause in a SELECT statement

Correct.

34.You need to change the default sort order of the ORDER BY clause so
that the data is displayed in reverse alphabetical order. Which keyword
should you include in the ORDER BY clause?

Mark for Review
(1) Points

DESC (*)

ASC

SORT

CHANGE

Correct.

35.Which logical operator returns TRUE if either condition is true?

Mark for Review

(1) Points

OR (*)

AND

NOT

BOTH

Correct.

36.From left to right, what is the correct order of Precedence?

Mark for Review
(1) Points

Arithmetic, Concatenation, Comparison, OR (*)

NOT, AND, OR, Arithmetic

Arithmetic, NOT, Logical, Comparison

Arithmetic, NOT, Concatenation, Logical

Correct.

37.Which statement about the default sort order is true?

Mark for Review
(1) Points

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.

38.The EMPLOYEES table contains these columns:

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?

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.

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 want to display all players' names with position 6900 or greater.
You want the players names to be displayed alphabetically by last
name and then by first name. Which statement should you use to
achieve the required results?

SELECT last_name, first_name

FROM players
WHERE position_id >=6900
ORDER BY last_name, first_name;

(*)

SELECT last_name, first_name

FROM players
WHERE position_id > 6900
ORDER BY last_name, first_name;
SELECT last_name, first_name

FROM players
WHERE position_id <= 6900
ORDER BY last_name, first_name;
FROM players

WHERE position_id >= 6900
ORDER BY last_name DESC, first_name;

Mark for Review
(1) Points

Correct.

40.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?

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

Mark for Review
(1) Points

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.



Section 11

(Answer all questions in this section)

41.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

42.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.

43.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

44.If a primary key is a set of columns then one column must be null.
True or False?

True

False (*)



Mark for Review
(1) Points

Correct

45.The text below is an example of what constraint type:

If the number of BOOKS lent to a BORROWER in the LIBRARY
exceeds 5, then we must send him/her a letter requesting the return of
the BOOKS, which will require extra programming to enforce.

Entity integrity
User-defined integrity (*)
Column integrity
Referential integrity

Mark for Review
(1) Points

Incorrect. Refer to Section 11 Lesson 1.

46.A table must have at least one candidate key, as well as its primary
key. True or False?

True

False (*)



Mark for Review
(1) Points

Correct

47.Foreign keys must be null. True or False?

Mark for Review
(1) Points

True

False (*)

Correct

48.A table must have a primary key. True or False?

Mark for Review
(1) Points

True

False (*)


Correct

49.When mapping supertypes, relationships at the supertype level
transform as usual. Relationships at subtype level are implemented as

Mark for Review

foreign keys, but the foreign key columns all become mandatory. True
or False?

True

False (*)

(1) Points

Correct

50.It is possible to implement non-transferability via a simple Foreign Key
Relationship. True or False?

True

False (*)



Mark for Review
(1) Points

Incorrect. Refer to Section 12

Un comentariu:

  1. Hey,

    Is there any other way to get answer like this? I tried without success. anyway thanks for your help.

    I learned a lot from Besant Technologies in my college days. They are the Best Oracle Training Institute in Chennai

    Link as :http://www.besanttech.com/best-oracle-training-institute-in-chennai.html

    RăspundeţiȘtergere