Way2success
  Oracle
 
# Paper 1


Hints
It contains 30 Questions of SQL + PL/SQL and the TIME allocated  is 30 minutes

After test (15 Mins.) a Oracle guy declared test results by  announcing the full name  of candidates and apologising to others. Very Polite.

Then another test for Programming is there.

After this they have to go for the round of Interviews.

Aptitude section of Oracle

1.Two words are given by
Word 1: 83263641
Word 2: 3715468 ( don?t remember the order of the numbers.)
Each character is represented by a digit and each digit represents a character. It is given that T and R occur four times. S and A occur two times. E, P, O and M occur one time each. The word starts with T. The letter E occurs in word one only. The questions were,
  a). Which number represents T.
  b). Which number represents S.
  c).  Which character represents 2.
  d).  Which digit represents A.
  e).   Which word represents word 2.

2.There was a table with data related to net sales, gross profit, etc... and some questions were asked related to it. Very easy?

3.A man spent 1/6th of his life in child hood, 1/12th of his life as youngster and 1/7th of his life as a bachelor. After five years of his marriage a son was born to him. The son died four years before the father died and at the time of his death his age was half the total age of his father.
    The questions were,
  a.  What is the age of the father. (84)
  b.  At what age was he married.(33)
  c.  What is the age of his son.(42)

4.Rita puts 9 pairs of black socks and 8 pairs of white socks in a drawer. She takes 3 socks. What is the probability that we get a pair of black socks.

5.What is the value of the following series   1/7 + 2/72 + 1/73 +2/74 + 1/75 + .

6.What should be the value of a, in the polynomials x2 ? 11x + a and x2 ? 14x + 2a, so that these two polynomials have common factors. a) 24   b)1   c)-1   d)1/2

7.What is the sum of all the four digit numbers formed using the digits 0, 1, 2 and 3. None of the two digits should be repeated.

8.a right angled triangle, the square of the hypotenuse is twice the product of the other two sides. Then one of the acute angles of the triangle is?  a)  450 b)  300 c)  600 d)  150

9.There are two square rooms. Both are of same height. The second room is 5m longer than the first room. The rate for papering the walls is 10 paisa per square meter. The total cost for papering the rooms is Rs 60 and Rs 80. What is the height of the rooms.

10.There are two numbers in the ratio 8:9. if the smaller of the two numbers is increased by 12 and the larger number is reduced by 19 thee the ratio of the two numbers is 5:9.
Find the larger number.

11.In class of 10 students, the teacher writes a number on the board. The first student tells that the number is divisible by 1, the second student tells that the number is divisible by 2, the third by 3, the forth by 4 and so on till 10. If the statement of one of the students in wrong then what is the least number possible.

12.The first and the last sentences of a set of sentences are given. The middle four sentences are in jumbled form we have to select the order in which the sentences are to be placed so that they convey a meaningful message.

13.A passage with two paragraphs is given. Then two questions are asked based on it. Could not remember it.

14.A stamp collector arranges his stamps during his free time. When he arranges his stamps in pairs, there is one stamp left. It is the same when he arranges the stamps in groups of 3, 4, 5 and 6. Now, how many stamps will he be left with when he arranges them in groups of 8. 
       Technical

15.Delete from table tempv where rowid in (select rowid from tempv where rowid in (((select min(rowid) from tempv  where ... count(*) > 1))) union(select rowid from tempv where rowid in (((select min(rowid) from tempv where ... count(*) > 1)));

16.When there is a failure in fetching the rows from a cursor...
    a. %isopen
    b. %notfound
    c. %found
    d. %rowcount

17.Select 'oracle' from dual where null = null;
    a. oracle
    b. null
    c. error out
    d. no rows selected

18.here is a question of Package body and Package Specification,  they have provided the code for that describing the scenario of  movie_tickets_sold and asked the programmer to insert a block of  code...., where that code block to be inserted? In Package body? or  in Package Specification?

19.Which of the following operator is not used in Outer Join?
a. =
b. !=
c. AND
d. OR

20.PL/SQL uses which of the following
a. Early Binding
b. Late binding
c. No Binding
d. Deferred Binging

21.Following is a database trigger, CREATE OR REPLACE TRIGGER delete_row ON DELETE
  not remember the complete question.

22.If table contains 100 rows and it is truncated, how many rows get  updated
a. 0
b. 1
c. 100
d. No rows updated

There are some questions on Basic SELECT STATEMENTS...

Some questions on Triggers, Procedures

VARRAYS/Nesting of Table: 1 question is there

NLS_DATE_FORMAT: 1 question

1.The size of the float data type in C language is ?

2.The size of the float data type in C language is ?
What is the output of the following C program.
 Main()
    {
       printf(?%c?,?abcdefgh?[4]);
     }

3.What is the o/p of the following C-program.
  Main()
     { 
        char str[7]=?strings?;
        printf(?%s?,str);
     }

4.main()
  {
    file *fp;
    fp=fopen(?xyz?,?r?);
  }
    What does fp point to?

5.What is the maximum no. of arguments that can be given in a command line in C.

6.When the variables are pushed into the stack, which method is used to retrieve them from it.
a) pop b) pull c) remove d) none of these.

7.What is the size of integer variable in JAVA?

8.A programs reads ?The man and the boyrn? from a file using fgets() and stores it in str[]. Then the string stored in str is
   a) ?The man and the boyrn?
   b) ?The man and the boyr?
   c) ?The man and the boyn?
   d) ?The man and the boy?

After this written exam, we had another written for the short-listed students. It contained algorithms and coding. There were two questions.

1.The first one was the conversion of a given expression into its postfix form and then to evaluate it.

2.The question was to have a circularly linked link-list of integers 1 to n. I we give k as an input then we have to output(print) 1, k, 1+2k, 1+3k ? till n and we have to delete these numbers. When we give then next k we have to continue the same process starting with 2. The linked needs to be maintained.


# Paper 2
1.Which of the following statements contains an error?                             
        a..      SELECT * FROM emp WHERE empid = 493945;
        b.     SELECT empid FROM emp WHERE empid= 493945;
        c.     SELECT empid FROM emp;
        d.     SELECT empid WHERE empid = 56949 AND lastname = 'SMITH';
   2.Which of the following correctly describes how to specify a column alias?
        a.      Place the alias at the beginning of the statement to describe the table.
        b.     Place the alias after each column, separated by white space, to describe the column.
        c.     Place the alias after each column, separated by a comma, to describe the column.
        d.     Place the alias at the end of the statement to describe the table. 
   3. The NVL function
       a.      Assists in the distribution of output across multiple columns.
       b.     Allows the user to specify alternate output for non-null column values.
       c.     Allows the user to specify alternate output for null column values.
       d    Nullifies the value of the column output
   4. Output from a table called PLAYS with two columns, PLAY_NAME and AUTHOR,is shown below.Which of the following SQL statements produced it?
      PLAY_TABLE
        "Midsummer Night's Dream", SHAKESPEARE
        "Waiting For Godot", BECKETT
        "The Glass Menagerie", WILLIAMS   

          a   SELECT play_name || author FROM plays;
          b   SELECT play_name, author FROM plays;
          c    SELECT play_name||', ' || author FROM plays;

          d    SELECT play_name||', ' || author PLAY_TABLE FROM plays;

   5. Issuing the DEFINE_EDITOR="emacs" will produce which outcome?                  
         a.      The emacs editor will become the SQL*Plus default text editor.
         b.     The emacs editor will start running immediately.
         c.     The emacs editor will no longer be used by SQL*Plus as the default text editor.
         d.     The emacs editor will be deleted from the system.
   6. The user issues the following statement. What will be displayed if the EMPID selected is 60494? SELECT DECODE(empid,38475, "Terminated",60494, "LOA", "ACTIVE")FROM  emp;
         a.      60494
         b.     LOA
         c.     Terminatedd.     ACTIVE
   7. SELECT (TO_CHAR(NVL(SQRT(59483), "INVALID")) FROM DUAL is a valid SQL statement.
         a.      TRUE
        b.     FALSE
   8.The appropriate table to use when performing arithmetic calculations on values defined within the SELECT statement (not pulled from a table column) is
         a.      EMP
        b.     The table containing the column values
        c.     DUALD.     An Oracle-defined table
   9. Which of the following is not a group function?                                              
               a.      avg( )
               c.     sqrt( )
               c.     sum( )
               d.     max( )
  10.Once defined, how long will a variable remain so in SQL*Plus?
              a. Until the database is shut down
              b. Until the instance is shut down
              c. Until the statement completes
              d. Until the session completes
  11. The default character for specifying runtime variables in SELECT statements is
              a.      Ampersand
              b.     Ellipses
              c.     Quotation marks
              d.     Asterisk
  12. A user is setting up a join operation between tables EMP and DEPT. There are some employees in the EMP table that the user wants returned by the query, but the employees are not assigned to departments yet. Which SELECT statement is most appropriate for this user?
         a.   select e.empid, d.head from emp e, dept d;
        b.  Select e.empid, d.head from emp e, dept d where e.dept# = d.dept#;
        c.   Select e.empid, d.head from emp e, dept d where e.dept# = d.dept# (+);
        d.  Select e.empid, d.head from emp e, dept d where e.dept# (+) = d.dept#;
  13. Developer ANJU executes the following statement: CREATE TABLE animals AS SELECT * fromMASTER.ANIMALS; What is the effect of this statement?                            
      a.      A table named ANIMALS will be created in the MASTER schema with the same data as the ANIMALS table owned by ANJU
      b.     A table named ANJU will be created in the ANIMALS schema with the same data as the ANIMALS table owned by  MASTER
      c.     A table named ANIMALS will be created in the ANJU schema with the same data as the ANIMALS table owned by MASTER.
      d.     A table named MASTER will be created in the ANIMALS schema with the same data as the ANJU table owned by ANIMALS.
  14. User JANKO would like to insert a row into the EMPLOYEE table, which has three columns: EMPID,LASTNAME, and SALARY. The user would like to enter data for EMPID 59694, LASTNAME Harris, but no salary. Which statement would work best?
       a.  INSERT INTO employee VALUES (59694,'HARRIS', NULL);
       b.  INSERT INTO employee VALUES (59694,'HARRIS');
       c.  INSERT INTO employee (EMPID, LASTNAME, SALARY) VALUES (59694,'HARRIS');
       d.  INSERT INTO employee (SELECT 59694 FROM 'HARRIS');
  15.Which three of the following are valid database datatypes in Oracle? (Choose three.)
       a.    CHAR
       b.    VARCHAR2
       c.     BOOLEAN
       d.     NUMBER
  16. Omitting the WHERE clause from a DELETE statement has which of the following effects?
        a.      The delete statement will fail because there are no records to delete.
        b.     The delete statement will prompt the user to enter criteria for the deletion            
        c.     The delete statement will fail because of syntax error.
        d.     The delete statement will remove all records from the table.
  17. Creating a foreign-key constraint between columns of two tables defined with two different  datatypes will produce an error.
       a.   TRUE
       b.    FALSE
  18. Dropping a table has which of the following effects on a nonunique index created for the table?
        a.   No effect.
         b.  The index will be dropped.
        c.   The index will be rendered invalid.
        d.   The index will contain NULL values.
  19. To increase the number of nullable columns for a table,
      a.   Use the alter table statement.
      b.   Ensure that all column values are NULL for all rows.
      c.   First increase the size of adjacent column datatypes, then add the column.
      d.   Add the column, populate the column, then add the NOT NULL constraint.
  20.Which line of the following statement will produce an error?
      a.   CREATE TABLE goods
      b.   (good_no NUMBER,
      c.    good_name VARCHAR2 check(good_name in (SELECT name FROM avail_goods)),
      d.   CONSTRAINT pk_goods_01
      e.     PRIMARY KEY (goodno));
      f.     There are no errors in this statement.
  21. MAXVALUE is a valid parameter for sequence creation.                         
      a. TRUE
      b. FALSE
  22.Which of the following lines in the SELECT statement below contain an error?
        a   SELECT DECODE(empid, 58385, "INACTIVE", "ACTIVE") empid
       b.  FROM emp
       c.  WHERE SUBSTR(lastname,1,1) > TO_NUMBER('S')
       d.  AND empid > 02000
       e.  ORDER BY empid DESC, lastname ASC;
       f.   There are no errors in this statement.
  23.Which function below can best be categorized as similar in function to an IF-THEN-ELSE statement?
       a.    SQRT
       b.    DECODE
       c.     NEW_TIME
       d.    ROWIDTOCHAR
  24.Which two of the following orders are used in ORDER BY clauses? (choose two)
       a.    ABS
       b.    ASC
       c.    DESC
       d.    DISC
  25.You query the database with this command SELECT name FROM     employee WHERE   name LIKE  ?_a%?; Which names are displayed?
       a.   Names starting with ?a?
       b.   Names starting with ?a? or ?A?
       c.   Names containing ?a? as second character
       d.  Names containing ?a? as any letter except the firs

           PL/SQL
  26.Which of the following statements is true about implicit cursors?
      a.  Implicit cursors are used for SQL statements that are not named.
      b.  Developers should use implicit cursors with great care.
      c.  Implicit cursors are used in cursor for loops to handle data processing.
      d. Implicit cursors are no longer a feature in Oracle.
  27. Which of the following is not a feature of a cursor FOR loop?                        
      a.  Record type declaration.
      b.  Opening and parsing of SQL statements.
      c.  Fetches records from cursor.
      d.  Requires exit condition to be defined.
  28. A developer would like to use referential datatype declaration on a variable. The variable name is EMPLOYEE_LASTNAME, and the corresponding table and column is EMPLOYEE, and LNAME, respectively. How would the developer define this variable using referential datatypes?
        a.      Use employee.lname%type.
        b.     Use employee.lname%rowtype.
        c.     Look up datatype for EMPLOYEE column on LASTNAME table and use that.
        d.     Declare it to be type LONG.
  29.Which three of the following are implicit cursor attributes?
         a.  %found
         b.  %too_many_rows
         c.  %notfound
         d.  %rowcount
         e.   %rowtype
  30. If left out, which of the following would cause an infinite loop to occur in a simple loop?
       a.   LOOP
        b.  END LOOP
       c.   IF-THEN
       d.   EXIT
  31. Which line in the following statement will produce an error?                      
        a.   cursor action_cursor is
        b.   select name, rate, action
        c.   into action_record
        d.   from action_table;
        e.   There are no errors in this statement.
  32. The command used to open a CURSOR FOR loop is
              a.    open
              b.    fetch
              c.    parse
              d.    None, cursor for loops handle cursor opening implicitly
  33. What happens when rows are found using a FETCH statement
               a.   It causes the cursor to close
               b.   It causes the cursor to open
               c.   It loads the current row values into variables
               d.   It creates the variables to hold the current row values
  34. CREATE OR REPLACE PROCEDURE find_cpt (v_movie_id {ArgumentMode}NUMBER, v_cost_per_ticket {argument mode} NUMBER)IS
        BEGIN
          IF v_cost_per_ticket  > 8.5 THEN
         SELECT    cost_per_ticket
         INTO    v_cost_per_ticket
         FROM    gross_receipt
         WHERE  movie_id = v_movie_id;                                 
          END IF;
          END;
          Which mode should be used for V_COST_PER_TICKET?
              a.      IN
              b.     OUT
              c.     RETURN
              d.     IN OUT
  35. CREATE OR REPLACE TRIGGER update_show_gross {trigger information}
         BEGIN
           {additional code}
         END;
      The trigger code should only execute when the column, COST_PER_TICKET, is greater than $3.75. Which trigger information will you add?
          a.   WHEN (new.cost_per_ticket > 3.75)
         b.   WHEN (:new.cost_per_ticket > 3.75
         c.    WHERE (new.cost_per_ticket > 3.75)
         d.    WHERE (:new.cost_per_ticket > 3.75)
  36.What is the maximum number of handlers processed before the PL/SQL block is exited when an
            exception occurs?
             a.      Only one
               b.     All that apply
               c.     All referenced
               d.     None
  37. For which trigger timing can you reference the NEW and OLD qualifiers?           
            a.   Statement and Row
            b.   Statement only
            c.   Row only
            d.   Oracle Forms trigger
  38. CREATE OR REPLACE FUNCTION get_budget(v_studio_id IN NUMBER) RETURN number
       ISv_yearly_budget NUMBER;
        BEGIN
         SELECT   yearly_budget
         INTO       v_yearly_budget
         FROM             studio
        WHERE          id = v_studio_id;
         RETURN v_yearly_budget;
         END;
         Which set of statements will successfully invoke this function within SQL*Plus?
           a    VARIABLE g_yearly_budget NUMBER EXECUTE g_yearly_budget := GET_BUDGET(11);
           b.   VARIABLE g_yearly_budget NUMBER EXECUTE :g_yearly_budget := GET_BUDGET(11);
           c.    VARIABLE :g_yearly_budget NUMBER EXECUTE :g_yearly_budget := GET_BUDGET(11);
           d.    VARIABLE g_yearly_budget NUMBER :g_yearly_budget := GET_BUDGET(11);
  39. CREATE OR REPLACE PROCEDURE update_theater (v_name IN VARCHAR2, v_theater_id IN  NUMBER) IS
              BEGIN
             UPDATE   theater
            SET      name = v_name
             WHERE  id = v_theater_id;
             END update_theater;
         When invoking this procedure, you encounter the error: ORA-00001: Unique constraint (SCOTT.THEATER_NAME_UK) violated.How should you modify the function to handle this error?
       a.   An user defined exception must be declared and associated with the error code and handled in the EXCEPTION
             section.                                                                   
       b.   Handle the error in EXCEPTION section by referencing the error code directly.
       c.    Handle the error in the EXCEPTION section by referencing the UNIQUE_ERROR predefined exception.
       d.     Check for success by checking the value of SQL%FOUND immediately after the UPDAT statement.
  40. CREATE OR REPLACE PROCEDURE calculate_budget IS v_budget studio.yearly_budget%TYPE;
      BEGIN
      v_budget := get_budget(11);
      IF v_budget < 30000000 THEN
      set_budget(11,30000000);
      END IF;
      END;
      You are about to add an argument to CALCULATE_BUDGET. What effect will this have?
      a.  The GET_BUDGET function will be marked invalid and must be recompiled before the next  execution.
      b.  The SET_BUDGET function will be marked invalid and must be recompiled before the next   execution.
      c.  Only the CALCULATE_BUDGET procedure needs to be recompiled.
      d.  All three procedures are marked invalid and must be recompiled.
  41. Which procedure can be used to create a customized error message?
         a.  RAISE_ERROR
         b.  SQLERRM
         c.  RAISE_APPLICATION_ERROR
         d.  RAISE_SERVER_ERROR
  42. The CHECK_THEATER trigger of the THEATER table has been disabled. Which command can yo issue to enable this trigger?
         a.  ALTER TRIGGER check_theater ENABLE;                                             
         b.  ENABLE TRIGGER check_theater;
         c.  ALTER TABLE check_theater ENABLE check_theater;
         d.  ENABLE check_theater;
  43. Examine this database trigger CREATE OR REPLACE TRIGGER prevent_gross_modification   {additional trigger information}
         BEGIN
            IF TO_CHAR(sysdate,?DY?) = ?MON? THEN
               RAISE_APPLICATION_ERROR(-20000,?Gross receipts cannot be ? || ?deleted on Monday?);
            END IF;
        END; This trigger must fire before each DELETE of the GROSS_RECEIPT table. It should fire only once for the entire
       DELETE statement. What additional information must you add?
       a.  BEFORE DELETE ON gross_receipt
       b.  AFTER DELETE ON gross_receipt
       c.  BEFORE (gross_receipt DELETE)
       d.  FOR EACH ROW DELETED FROM gross_receipt
  44. Examine this function CREATE OR REPLACE FUNCTION set_budget (v_studio_id IN NUMBER,
      v_new_budget IN NUMBER) IS
       BEGIN
            UPDATE studio
           SET yearly_budget = v_new_budget                             
           WHERE id = v_studio_id;
           IF SQL%FOUND THEN
                    RETURN TRUEl;
            ELSE
         RETURN FALSE;
         END IF;
         COMMIT;
      END;
        Which code must be added to successfully compile this function?
       a.  Add ?RETURN;? right before the ?IS? keyword.
       b.  Add ?RETURN number? right before the ?IS? keyword.
       c.  Add ?RETURN boolean? right after the ?IS? keyword.
       d.  Add ?RETURN boolean? right before the ?IS? keyword.
  45. Under which circumstance must you recompile the package body after recompiling the package specification?
        a.  Altering the argument list of one of the package constructs
        b.  Any change made to one of the package constructs
        c.  Any SQL statement change made to one of the package constructs
        d.  Removing a local variable from the DECLARE section of one of the package constructs
  46.Procedure and Functions are explicitly executed. This is different from a database trigger. When is
         a database trigger executed?
         a. When the transaction is committed
         b. During the data manipulation statement
         c. When an Oracle supplied package references the trigger                       
         d. During a data manipulation statement and when the transaction is committed
  47.Which Oracle supplied package can you use to output values and messages from database  triggers, stored procedures and functions within SQL*Plus?
         a. DBMS_DISPLAY
         b. DBMS_OUTPUT
         c. DBMS_LIST
         d. DBMS_DESCRIBE
  48.What occurs if a procedure or function terminates with failure without being handled?
        a. Any DML statements issued by the construct are still pending and can be committed or rolled back.
        b.  Any DML statements issued by the construct are committed
        c.  Unless a GOTO statement is used to continue processing within the BEGIN section, the  construct terminates. The
             construct rolls back any DML statements issued and returns the unhandled exception to the calling environment.
  49.Examine this code
         BEGIN
            theater_pck.v_total_seats_sold_overall := theater_pck.get_total_for_year;
         END;
        For this code to be successful, what must be true?
      a. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist only in the body
          of the THEATER_PCK package.
      b. Only the GET_TOTAL_FOR_YEAR variable must exist in the specification of the THEATER_PCK package.
      c. Only the V_TOTAL_SEATS_SOLD_OVERALL variable must exist in the specification of the THEATER_PCK package. 
      d. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist in the specification of the THEATER_PCK package.
  50. A stored function must return a value based on conditions that are determined at runtime.  Therefore, the SELECT statement cannot be hard-coded and must be created dynamically when  he function is executed. Which Oracle supplied package will enable this feature?
      a.  DBMS_DDL
      b.  DBMS_DML                                                                                       
      c.  DBMS_SYN
      d.  DBMS_SQL

 
  Today, there have been 35 visitors (179 hits) on this page!  
 
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free