Navigation bar
  Print document View PDF document Start Previous page
 1 of 23 
Next page End 1 2 3 4 5 6  

Test: Mid Term Exam Semester 1 - Part II 
 
 
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Mid Term Exam Semester 1 - Part II 
      
  1.  There are 12 distinct JOB_IDs in the EMPLOYEES table. You need to
write some PL.SQL code to fetch and display all the employees with a
specific JOB_ID. The chosen JOB_ID can be different each time the code is
executed. 
What is the best way to do this?  Mark for Review 
(1) Points 
      
    Write 12 separate PL/SQL blocks, each declaring a cursor with a
different JOB_ID in the WHERE clause. 
  
    Write a single PL/SQL block which declares 12 cursors, one for each
distinct value of JOB_ID. 
  
    Write a single PL/SQL block which declares one cursor using a
parameter for the JOB_ID. (*) 
  
    Write a single PL/SQL block which uses a cursor to fetch all the
employee rows, with an IF statement to decide which of the fetched rows
to display. 
  
      
      Correct  
  
      
  2.  What is one of the advantages of using parameters with a cursor? 
Mark for Review 
(1) Points 
      
    You can use a cursor FOR loop. 
  
    You can declare the cursor FOR UPDATE. 
  
    You do not need to DECLARE the cursor at all. 
  
    You can use a single cursor to fetch a different set of rows each
time the cursor is opened. (*) 
  
    It will execute much faster than a cursor without parameters. 
  
      
      Correct  
  
      
  3.  What will be the value of v_result after the following code is
executed?
DECLARE 
    v_grade CHAR(1) := NULL; 
    v_result VARCHAR2(10); 
BEGIN 
Previous page Top Next page