0% found this document useful (0 votes)
20 views

Sqltest - 1

sql
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Sqltest - 1

sql
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1) CREATE TABLE emp(empno NUMBER,

ename VARCHAR2(30),
salary NUMBER(7,2));

The above table has ten records. Now it is required to execute the below DML statement.
What is the result ?

DELETE SALARY FROM emp WHERE empno=5;

a) Employee record 5 will be deleted


b) Salary for the employee 5 will be deleted
c) The salary datablock will corrupt
d) Compile time error

2) How do you identify hierachical queries?

a) Presence of DISTINCT keword


b) Presence of columns from outer query table & inner query table
c) Presence of START WITH & CONNECT PRIOR keyword
d) Presence of HIERARCHICAL keword

3) Tables emp & dept have to be joined, so that we can get all records of emp table. Which join operation
is suitable? Assume dept as the right table.

a) Left outer join


b) Right outer join
c) Equi join
d) Self join

4) SELECT nvl(salary,999) from emp;


What is the result of execution?
a) All employees’ salary will be updated to 999
b) None of employees’ salary will be updated to 999
c) System will hang
d) Null salaries will be updated to 999

5) Which of the below mentioned functions work as if else statement?


a) Coalesce()
b) Decode()
c) Ifelse()
d) Ifelseif()

6) SELECT nvl2(salary,999,1000) from emp;


What is the result of execution?
a) If the salary is not null it will be replaced by 999
b) If the salary is null it will be replaced by 999
c) If the salary is 999, then it will be replaced by 1000
d) This question is bugging like anything
7) Can we create SYNONYM for a remote user?
a) YES
b) NO
c) Not applicable
d) I am an idiot, I don’t know

8) SELECT ename FROM emp WHERE empno between 2000 AND 2010;
How many records will be retrieved from the database
a) 2010
b) 2000
c) 10
d) 11

9) SELECT round(1350,-2) FROM dual


What is the result?
a) 1350
b) 1352
c) 1400
d) 1300

10) Can DML operations be performed on our table through a complex view.
a) YES
b) NO
c) Easy question
d) Not sure

11) We can perform DML operations on READONLY views


a) YES
b) NO
c) Yes, if the view is empty
d) With administrator privileges, we can do it

12) SELECT ename FROM emp WHERE ename LIKE '_h%'


The above query will return, all names with,
a) ‘h’ as the first character & any no. Of other characters after ‘h’
b) ‘H’ as the first character & any one character after ‘h’
c) Any set of characters before ‘h% & any no. Of other characters after ‘h’
d) Any one character before ‘h’ & any no. Of characters after ‘h’

13) Can we use ‘IS NULL’ to compare with the NULL values?
a) YES
b) NO
c) Invalid question
d) Compile error

14) What is the functionality of ‘WITH CHECK OPTION ‘


a) Blocks semantically invalid insert operation on views
b) Blocks select operation on views
c) Blocks the view from being dropped
d) Blocks DML operations on the base table

15) What is use of MERGE command?


a) INSERT & DELETE
b) INSERT & UPDATE
c) UPDATE & DELETE
d) None of the above

16) Inline view is a schema object like table (Choose multiple answers)
a) YES
b) NO
c) Can be dropped
d) Can not be dropped

17) What is use of clustering (Choose multiple answers)


a) Enhances the capacity of CPU
b) Enhances the speed of the application
c) Join operation will be faster
d) None of the above

18) Materialized views are used in


a) CTS ‘C/C++ device driver’ projects
b) Data warehousing projects
c) Only in HMS projects
d) This concept is not taught

19) What is the use of database link


a) We can access schema objects of other users
b) We can bypass the security provided by ORACLE
c) This feature is not supported by ORACLE
d) None of the above

20) SCN_TO_TIMESTAMP can be used to find out the latest timing on which a change is made to a particular
table.
a) YES
b) NO
c) Don’t know
d) None of the above

21) CREATE TABLE cts_employee(name VARCHAR2(38),


dept_id NUMBER,
designation VARCHAR2(20),
salary NUMBER(5) DEFAULT 1000);
What is the result?

a) By default it allows 1000 salary records in the table


b) All records will be set to 1000 & can’t be changed
c) Default value of 1000 will be assigned to salary field, if value not given during insertion
d) Invalid option

22) Column with UNIQUE constraint can’t have NULL values


a) TRUE
b) FALSE
c) UNIQUE is not a constraint
d) UNIQUE can’t be applied on column

23) For primary & foreign key relationship, the data type & size of the columns should both be same
a) Not applicable
b) TRUE
c) Invalid rule
d) FALSE

24) Why do we use ORDER BY clause in the subquery of a view?


a) To sort the records in ascending order
b) To sort the records in descending order
c) Both ascending and descending sort
d) Invalid question

25) Select TCL statements (Multiple answers)


a) DROP
b) ROLLBACK
c) DELETE
d) SAVEPOINT
e) COMMIT
1) d - Compile error
2) c - START WITH & CONNECT PRIOR
3) a - Left outer join
4) d - Null salaries will be updated to 999
5) b - Decode()
6) a - If the salary is not null it will be replaced by 999
7) a - YES
8) d - 11
9) c - 1400
10) b - NO
11) b - NO
12) d - Any one character before ‘h’ & any no. Of characters after ‘h’
13) a - YES
14) a - Blocks insert operation on views
15) b - INSERT & UPDATE
16) b, d - NO, Can't be dropped
17) b ( Enhances the speed of the application ), c (Join operation will be faster)
18) b -Data warehousing projects
19) a -We can access schema objects of other users
20) a - YES
21) c) Default value of 1000 will be assigned to salary field, if value not given during insertion
22) b - FALSE
23) b - TRUE
24) d Invalid question
25) b (ROLLBACK), d (SAVEPOINT), e(COMMIT)

You might also like