May 22 Wings1 PLSQL Previous Quesions
May 22 Wings1 PLSQL Previous Quesions
May 22 Wings1 PLSQL Previous Quesions
1. We are required to run a set of commands to process a set of records when using explicit cursors.
List the correct sequence of commands to process a set of records when using explicit cursors as
described below.
1. INITIALIZE, GET, CLOSE
i
at
2. CURSOR, GET, FETCH, CLOSE
ap
3. OPEN, FETCH, CLOSE
aj
4. CURSOR, FETCH, CLOSE
Pr
ar
um
2. If a "right outer join" in PL SQL does not find matching rows, it shows NULL results of the table on
lK
which side in this scenario?
1. Left
u
At
2. Right
3. Center
by
4. Both Sides d
te
bu
tri
1. Implicit cursors are used for SQL statements that are not named.
D
3. Implicit cursors are used in cursor for loops to handle data processing.
ee
4. We are working with TRUNCATE statements and would like to understand which of the following are
ed
correct with regards to TRUNCATESs in SQL when compared to the DELETE statement. Which
at
5. We are required to create a procedure MYPROC that accepts two number parameters X and Y.
Which among the below queries can we use in this scenario?
1. CREATE PROCEDURE myproc (x NUMBER, y NUMBER) IS
2. CREATE PROCEDURE (x NUMBER, y NUMBER) myproc IS
3. CREATE PROCEDURE myproc IS (x NUMBER, y NUMBER)
4. CREATE PROCEDURE IS myproc (x NUMBER, y NUMBER)
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
6. We are working with TRUNCATE, DELETE and DROP statements and would like to understand
which of the following statement(s) is/are true about TRUNCATE, DELETE and DROP in PL SQL?
1. DELETE operation can be rolled back but TRUNCATE and DROP operations cannot be rolled
back.
2. DELETE operations cannot be rolled but TRUNCATE and DROP operations can be rolled back.
3. DELETE is an example of DML (Data Manipulation Language), but remaining are the examples
of DDL (Data Definition Language),
4. All are an example of DDL.
i
at
a) 1 and 3 b) 2 and 3
ap
c) 1 and 4 d) 2 and 4
aj
Pr
ar
7. Assume that you are required to calculate the average of the first ten natural numbers. Before
um
finding the average, you need to calculate the sum of all the ten numbers.
Which PL/SQL block will you select from the listed choices to print the sum of the first 10 numbers?
u lK
At
by
d
te
bu
tri
is
D
ly
ee
Fr
d
an
ed
at
ur
C
ly
al
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
8. Consider that a salesman wants to calculate the total sales of a product he made on a particular
day. He has information on the total units of the product sold and the price per unit item. From the
given options, identify which is the function to calculate the total sales by passing the no. of items
sold and the unit price of the item as the parameters to the function.
i
at
ap
aj
Pr
ar
um
ulK
At
by
d
te
bu
tri
is
D
9. What is the value of customer_id within the nested block in the example below?
ly
ee
DECLARE
d
DECLARE
ur
BEGIN
al
NULL;
rs
END;
Pe
END;
1. 678 2. 10000
3. AP56 4. 467.87
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
10. What is the new salary of Manisha printed on the output screen? (Note that salary is represented
using the sal attribute)
CREATE TABLE EMPLOYEE
(
empId INTEGER PRIMARY KEY,
i
at
name TEXT NOT NULL,
ap
sal INTEGER,
aj
comm INTEGER
Pr
);
ar
INSERT INTO EMPLOYEE VALUES(1,'Ravi',30000,250);
um
INSERT INTO EMPLOYEE VALUES(2,'Manisha',50000,0);
INSERT INTO EMPLOYEE VALUES(3,'Alekhya',60000,NULL);
u lK
select * from EMPLOYEE;
At
by
delimiter $$
CREATE PROCEDURE raise()
d
te
BEGIN
bu
UPDATE EMPLOYEE
Set sal = sal + (10/100) * sal
tri
1. 50000 2. 0
Fr
3. 55000 4. 45000
d
an
ed
11. We are required to add y months to “x” date while writing a query in PL SQL. Which among the
at
1. LAST_DAY(x);
C
2. ADD_MONTHS(x, y);
ly
3. MONTHS_BETWEEN(x,y);
al
4. NEXT_DAY(x, day);
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
12. While working with Null values in PL SQL, we come across a few scenarios during computation.
What among the below is true for a NULL value scenario in SQL?
1. Null + 1 = Null 2. Null + 1 = 1
3. Null * 2 = Null 4. Null * 2 = 0
i
at
a. 1 and 3 b. 2 and 4
ap
c. 1 and 4 d. 2 and 3
aj
Pr
ar
um
lK
u
At
by
d
te
bu
tri
is
D
ly
ee
Fr
13. We are working with “HAVING” and “WHERE” clause statements and would like to understand
d
an
which of the following statement(s) is/are true about “HAVING” and “WHERE” clauses in PL/SQL?
1. “WHERE” is always used before “GROUP BY” and “HAVING” after “GROUP BY”
ed
2. “WHERE” is always used after “GROUP BY” clause and “HAVING” before “GROUP BY”
at
a. 1 and 3 b. 1 and 4
al
c. 2 and 3 d. 2 and 4
on
rs
Pe
14. We are required to support fetching of rows from start to end from a result set in PL SQL and are
not required to go to the previous row in the result set. Which among the following PL SQL features
can we use for the same?
1. External Cursors
2. Implicit Cursors
3. Forward Cursors
4. None of the above
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
15. What is the correct output of the given data retrieval code? Select the correct answer from the given
choices.
i
at
name TEXT NOT NULL,
ap
dept TEXT NOT NULL
);
aj
Pr
insert into employee values(1,'Don','Sales');
ar
insert into employee values(2,'Ravi','Accounts');
um
DELIMITER $$
lK
CREATE PROCEDURE myProc(in_id int)
u
READS SQL DATA
At
BEGIN
by
SELECT name, dept
FROM EMPLOYEE d
te
WHERE empId = in_id;
bu
END$$
DELIMITER;
tri
is
1. 0 2. 1
D
3. 2 4. Exception
ly
ee
Fr
d
an
ed
at
ur
C
ly
al
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
ap
aj
16. Tables A, B have three columns (namely: 'id', 'age' ,'name') each. These tables have no 'null' values
Pr
and there are 100 records in each of the tables.
ar
Below are two queries based on these two tables 'A' and 'B';
um
Query1:
SELECT A.id FROM A WHERE A.age > ALL (SELECT B.age FROM B WHERE B.name='Ankit')
lK
Query2:
u
SELECT A.id FROM A WHERE A.age > ANY (SELECT B.age FROM B WHERE B.name='Ankit')
At
Now, which of the following statements is correct for the output of each query?
by
1. The number of tuples in the output of Query 1 will be more than or equal to the output of Query 2
d
2. The number of tuples in the output of Query 1 will be equal to the output of Query 2
te
3. The number of tuples in the output Query 1 will be less than or equal to the output of
bu
Query 2
tri
17. What is the correct output of the given code? Select the right answer from the given choices.
Fr
d
an
ed
at
ur
C
ly
al
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
ap
aj
18. There is a requirement to execute a set of statements every time we have a situation of SERVER
Pr
ERROR during database operations. Which of the following PL/SQL sub-program methods can be
used to run this set of statements on SERVERERROR?
ar
um
1. Recursive functions
2. Parameter-based stored procedures
lK
3. Triggers
u
4. Implicit cursors
At
by
d
te
19. Assume that a software programmer has written the given code to find the sum. What will be the
bu
DECLARE
is
D
sum PLS_NUMBER;
BEGIN
Fr
END;
an
/
ed
1. 2147483648
C
3. 21474836471
al
4. 2147483646
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
ap
aj
Pr
ar
um
u lK
At
20. For the view-
by
Create view instructor_info AS
SELECT ID, name, building
d
te
FROM instructor, department
bu
1. Default Value
Fr
2. NULL
d
3. ERROR
an
4. 0
ed
at
ur
21. We are required to execute a set of PL SQL code lines by itself until it reaches some boundary
C
condition so the programmers can use the same set of code any number of times.
ly
Which PL SQL utility from among the below can help achieve this ?
al
on
1. Functions
rs
2. Stored procedure
Pe
22. Consider a scenario where an index scan is replaced by sequential scan in SQL, then what will
happen or what would be the possible outcomes from the below options ?
Note: Number of observations is equal to 1 million.
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
23. Usually, there are functions that may accidentally include infinite loops instead of finite loops:
1.Which element in pl/sql is used for infinite loops in a function?
2.How do you use the above element in pl/sql to define it?
i
at
ap
aj
Pr
ar
um
u lK
At
by
d
te
bu
24. Consider the relation T1 (A, B) in which (A, B) is the primary key and the relation T2 (A, C) where A
tri
is the primary key. Assume there are no null values and no foreign keys or integrity constraints.
is
D
25. We are required to convert the TIMESTAMP WITH TIMEZONE x to a TIMESTAMP containing the
C
date and time in UTC. Which among the below methods can we use to meet this requirement?
ly
al
1. LOCALTIMESTAMP();
on
2. CURRENT_TIMESTAMP();
rs
3. SYS_EXTRACT_UTC(x);
Pe
26. In PL SQL we are required to find all the unique students who have taken more than one course.
Which of the following queries can be used in this scenario?
1. SELECT DISTINCT e1.sid FROM enrolled As e1, enrolled As e2
where e1.sid != e2.sid AND e1.cid != e2.cid
2. SELECT DISTINCT e1.sid FROM enrolled As e1, enrolled As e2
where e1.sid = e2.sid AND e1.cid = e2.cid
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
27. We are required to write a SQL query to get the third-highest salary of an employee from the
employee_table. Which among the below queries can we use in this case?
1. SELECT TOP 1 salary
i
at
FROM (SELECT TOP 3 salary
ap
FROM employee table ORDER BY salary DESC) AS emp
ORDER BY salary ASC;
aj
2. SELECT TOP 3 salary
Pr
FROM employee_table ORDER BY salary DESC;
ar
3. SELECT TOP 3 salary
um
FROM employee_table ORDER BY salary ASC;
4. None of the above
u lK
At
by
d
te
28. What is the correct output of the given dynamic SQL statement?
bu
y NUMBER,
is
z NUMBER )
D
IS
ly
BEGIN
ee
DBMS_OUTPUT.PUT_LINE((x + y) * z);
Fr
END;
d
/
an
DECLARE
a NUMBER := 2;
ed
b NUMBER := 4;
at
plsql_block VARCHAR2(100);
ur
BEGIN
C
END;
on
1. 12 2. 16
3. 0 4. 24
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
ap
aj
Pr
ar
um
u lK
At
by
d
te
bu
tri
is
D
ly
ee
29. Consider there is a student table as shown in the figure. Assume that you need to insert a
Fr
component such that the ages are all automatically updated with a default value of 19 irrespective of
d
the insert value. Which option from the given choices will perform the task appropriately?
an
ed
at
ur
C
ly
al
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
ap
aj
Pr
ar
um
u lK
At
by
30. What is the proper output of the given pl/sql code?
d
te
Select the correct answer from the given choices.
bu
DECLARE
tri
BEGIN
ly
v_Num.EXTEND(4);
ee
END;
ur
/
C
ly
1. 1 1 2. 3 2
al
3. 2 3 4. 4 -1
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
ap
aj
Pr
ar
um
u lK
At
by
d
te
bu
tri
is
D
ly
ee
Fr
d
an
ed
at
ur
C
ly
al
on
rs
Pe
For all your queries just search on youtube by appending Atul with the query. Eg. tcs wings 1 atul
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
31. Consider the student table as shown in the figure. Assume that you need to update the age such
that it triggers a call to a message that displays the change in age.
i
at
ap
Which option from the listed choices will perform this task appropriately?
aj
Pr
ar
um
u lK
At
by
d
te
bu
tri
is
D
ly
ee
Fr
d
an
ed
at
ur
C
ly
al
32. Suppose we have a table ‘Employee’. In Employee table, we have a column named Salary.
on
1. T1 > T2 3. T1 ~ T2
2. T2 > T1 4. None of the above
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
33. In the given SQL statement, what is the output of the final select statement (SELECT * FROM
EmpLog?)
i
at
Dept number(3) NOT NULL
ap
);
aj
Insert into Employee values(1, 'Meenu', 30000, 10);
Pr
Insert into Employee values(1, 'ANIKA', 45000, 10);
ar
Insert into Employee values(1, 'JEFF', 67500, 40);
um
COMMIT;
lK
CREATE TABLE EmpLog
u
(
At
IEmpid number(10) NOT NULL,
by
IEmpName varchar2(50) NOT NULL,
IDept number(3) NOT NULL d
te
);
bu
BEGIN
ly
END;
Fr
/
d
WHERE dept=10;
COMMIT;
ed
1. No Data returned
al
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
1. 4 2. 5
ap
3. 8 4. 10
aj
Pr
35. Consider a scenario where we run the following Queries in the below order:
ar
Create a table “Me” using the SQL query
um
Query 1: Create table Me(name varchar(20), salary int);
Next, we create a view based on the “Me” table by using the following query.
lK
Query 2: Create view me_view as select name from me;
u
Finally, we run the following query:
At
Query 3: DROP TABLE Me CASCADE;
by
Query 4: select * from me_view;
d
te
Which of the following statements are true in this scenario?
bu
1. 1 and 3 2. 1 and 4
d
3. 2 and 3 4. 2 and 4
an
ed
36. Which option from the listed choices indicates the correct code that calls the given code and prints
at
{
ly
{
on
}
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
i
at
ap
aj
Pr
ar
um
u lK
At
by
d
te
bu
tri
is
D
ly
ee
Fr
d
an
ed
at
ur
C
ly
al
on
rs
Pe
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
37. What is the correct output of the listed code? Select the appropriate answer from the given choices.
DECLARE
TYPE StuRec IS RECORD (
Stu_id NUMBER(4) NOT NULL := 1001,
Stu_name VARCHAR2(30) NOT NULL := 'John',
Adm_id NUMBER(6):=800,
Addr_id NUMBER(4):= 1565
i
at
);
ap
Stu_rec StuRec;
BEGIN
aj
DBMS_OUTPUT.PUT_LINE('Student_id: ' || Stu_rec.Stu_id);
Pr
DBMS_OUTPUT.PUT_LINE('Student_name: ' || Stu_rec.Stu_name);
ar
DBMS_OUTPUT.PUT_LINE('Admission_id: ' || Stu_rec.Adm_id);
um
DBMS_OUTPUT.PUT_LINE('Address_id: ' || Stu_rec.Addr_id);
END;
lK
/
u
At
Choose the best option:
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.
ⒸNotes by Atul Kumar Prajapati - Watch the session on youtube channel for clear understanding
38. We are required to identify, which of the following column “A” or “C” given in the below table is a
“Primary Key” or “Foreign Key”?
Table header - (A, C)
Table rows - (2,4), (3,4), (4,3), (5,2), (7,2), (9,5), (6,4)
Note: We have defined ‘Foreign Key’ and ‘Primary Key’ in a single table.
i
at
2. Column ‘C’ is Foreign Key and Column ‘A’ is ‘Primary Key’
ap
3. Both can be ‘Primary Key’
4. Based on the above table, we cannot tell which column is ‘Primary Key’ and which is ‘Foreign
aj
Key’
Pr
ar
um
39. Consider a scenario where we run the following Queries in the below order:
Create a table “Me” using the SQL query
lK
Query 1: Create table Me(name varchar(20), salary int);
u
Next, we create a view based on the “Me” table by using the following query.
At
Query 2: Create view me_view as select name from me;
by
Finally, we run the following query:
Query 3: DROP TABLE Me; d
te
bu
1. 1 and 3 2. 1 and 4
an
3. 2 and 3 4. 2 and 4
ed
at
ur
40. Suppose that you were creating a row level trigger, then which of the following is the correct
C
Please do not pay anything for the notes. If you bought it, please report that Scam ID in groups.