Oracle Test1

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Sudha_test
S
Sudha_test
Community Contributor
Quizzes Created: 12 | Total Attempts: 36,119
Questions: 12 | Attempts: 640

SettingsSettingsSettings
Oracle Quizzes & Trivia

This is a sample test


Questions and Answers
  • 1. 

    Evaluate the set of SQLst:   CREATE TABLE dept (deptno NUMBER(2), dname VARCNAR2(14),                                                1oc VARCNAR2 (13)); ROLLBACK; DESCRIBE DEPT        What is true about the set?

    • A.

      The DESCRIBE DEPT statement displays the structure of the DEPT table.

    • B.

      The ROLLBACK statement frees the storage space occupies by the DEPT table.

    • C.

      The DESCRIBE DEPT statement returns an error ORA-04043: object DEPT does not exist.

    • D.

      The DESCRIBE DEPT statement displays the structure of the DEPT table only if there is a COMMIT statement introduced before the ROLLBACK statement.

    Correct Answer
    A. The DESCRIBE DEPT statement displays the structure of the DEPT table.
    Explanation
    The correct answer is that the DESCRIBE DEPT statement displays the structure of the DEPT table. This is because the DESCRIBE statement is used to retrieve information about the columns, datatypes, and constraints of a table, and in this case, it is specifically used to describe the DEPT table.

    Rate this question:

  • 2. 

    Evaluate the SQL statement DROP TABLE DEPT:Which four statements are true of the SQL statement?

    • A.

      You cannot roll back this statement.

    • B.

      All pending transactions are committed

    • C.

      All views based on the DEPT table are deleted

    • D.

      All data in the table is deleted, and the table structure is also deleted

    • E.

      All data in the table is deleted, but the structure of the table is retained.

    Correct Answer(s)
    A. You cannot roll back this statement.
    B. All pending transactions are committed
    D. All data in the table is deleted, and the table structure is also deleted
    Explanation
    The SQL statement "DROP TABLE DEPT" cannot be rolled back, meaning that once it is executed, it cannot be undone. Additionally, all pending transactions are committed, meaning that any changes made in those transactions will be permanently saved. Furthermore, the statement deletes all data in the DEPT table, including the table structure itself. Therefore, after executing this statement, the DEPT table will no longer exist in the database.

    Rate this question:

  • 3. 

    Which line is incorrect in this query? 1. CREATE TABLE ACTORS( 2. ACTOR_ID NUMBER NOT NULL 3. ,NAME VARCHAR2(32) NOT NULL 4. ,GENDER NUMBER DEFAULT 'M' NOT NULL 5. ,TYPECAST VARCHAR2(64) NULL);

    • A.

      4

    • B.

      2

    • C.

      5

    • D.

      4,5

    • E.

      2,5

    Correct Answer
    A. 4
    Explanation
    Line 4 is incorrect in this query. The data type 'NUMBER' is not compatible with the default value 'M', which is a character.

    Rate this question:

  • 4. 

     Which of these statements are true with respect to datatypes?

    • A.

      . NUMBER and FLOAT can be a maximum of 38 bytes.

    • B.

      The DATE datatype stores date values with a timestamp

    • C.

      CHAR and VARCHAR2 default to 1 byte if no length is defined.

    • D.

      Both VARCHAR2 and CHAR can exceed 2,000 bytes.

    • E.

      VARCHAR2 can be a maximum size of 4,000 bytes; CHAR, 2,000 bytes

    Correct Answer(s)
    B. The DATE datatype stores date values with a timestamp
    E. VARCHAR2 can be a maximum size of 4,000 bytes; CHAR, 2,000 bytes
    Explanation
    The given answer is correct because it accurately states that the DATE datatype stores date values with a timestamp, and VARCHAR2 can have a maximum size of 4,000 bytes while CHAR can have a maximum size of 2,000 bytes.

    Rate this question:

  • 5. 

    Which of these datatypes are valid?

    • A.

      NUMBER(10,2)

    • B.

      NUMBER(4,5)

    • C.

      FLOAT(122,2)

    • D.

      DATE(8)

    • E.

      CHAR(2500)

    Correct Answer(s)
    A. NUMBER(10,2)
    B. NUMBER(4,5)
    Explanation
    The given question asks for valid datatypes. In Oracle, NUMBER(10,2) is a valid datatype which represents a number with a precision of 10 digits and a scale of 2 digits. Similarly, NUMBER(4,5) is also a valid datatype in Oracle, representing a number with a precision of 4 digits and a scale of 5 digits.

    Rate this question:

  • 6. 

    A datatype is to be forcibly restricted to contain a number with specific restrictions. The number can be a whole number. The number can also contain three digits to the left of the decimal and two digits to the right of the decimal. What is its correct definition?

    • A.

      NUMBER

    • B.

      FLOAT

    • C.

      NUMBER(3,2)

    • D.

      NUMBER(2,3)

    • E.

      None of the above

    Correct Answer
    E. None of the above
  • 7. 

    Will an error be caused by this CREATE TABLE command? If so, what will cause the error? CREATE TABLE TEST(A FLOAT, B CHAR, C VARCHAR2, D NUMBER , E DATE);

    • A.

      No error will be returned.

    • B.

      Yes. The table name TEST is invalid.

    • C.

      Yes. All columns but the date column must have declared sizes.

    • D.

      Yes. The length of the VARCHAR2 variable must be defined.

    • E.

      Yes. The CHAR column must have a declared size.

    Correct Answer
    D. Yes. The length of the VARCHAR2 variable must be defined.
    Explanation
    The CREATE TABLE command will cause an error because the length of the VARCHAR2 variable must be defined. In Oracle, when creating a table, the length of a VARCHAR2 column must be specified. Since the length is not defined for the column C in the given command, an error will be returned.

    Rate this question:

  • 8. 

    Assuming a table is defined by the CREATE TABLE statement CREATE TABLE TEST(A NUMBER(8,3)); which of these INSERT commands will add a row to the table?

    • A.

      INSERT INTO TEST VALUES(10000.234);

    • B.

      INSERT INTO TEST VALUES(1000.2345);

    • C.

      INSERT INTO TEST VALUES(10000.2345);

    • D.

      INSERT INTO TEST VALUES(100000.2345);

    • E.

      INSERT INTO TEST VALUES(100000.24);

    Correct Answer(s)
    A. INSERT INTO TEST VALUES(10000.234);
    B. INSERT INTO TEST VALUES(1000.2345);
    C. INSERT INTO TEST VALUES(10000.2345);
    Explanation
    The INSERT commands that will add a row to the table are those that have a value that is within the range specified by the column definition. In this case, the column "A" is defined as NUMBER(8,3), which means it can hold a number with a maximum of 8 digits, with 3 digits after the decimal point. The values 10000.234, 1000.2345, and 10000.2345 all fall within this range and can be inserted into the table. The values 100000.2345 and 100000.24 exceed the maximum number of digits specified and cannot be inserted.

    Rate this question:

  • 9. 

    Select any correct answers:

    • A.

      DML commands execute an implicit rollback.

    • B.

      DML commands require an explicit COMMIT to be rolled back.

    • C.

      DDL commands can be undone.

    • D.

      DDL commands change data in tables.

    • E.

      None of the above.

    Correct Answer
    E. None of the above.
    Explanation
    The correct answer is "None of the above" because DML commands do not execute an implicit rollback. DML commands, such as INSERT, UPDATE, and DELETE, do not automatically rollback changes if there is an error or if the transaction is not committed. Instead, they require an explicit COMMIT to be rolled back. DDL commands, on the other hand, are used to define or modify the structure of database objects and cannot be undone. Therefore, none of the statements provided accurately describe the behavior of DML or DDL commands.

    Rate this question:

  • 10. 

    Given the table shown, select the INSERT commands that will cause errors: SQL> DESC TEST Name              Null?    Type ----------------- -------- ------------ ID                NOT NULL NUMBER STR               NOT NULL VARCHAR2(32) DEFAULT 'Empty String'

    • A.

      INSERT INTO TEST(ID) VALUES(1);

    • B.

      INSERT INTO TEST VALUES(2, 'This is a string');

    • C.

      INSERT INTO TEST(ID, STR) VALUES(3, 'This is another string');

    • D.

      INSERT INTO TEST(STR) VALUES('This is another string still');

    • E.

      INSERT INTO TEST(ID) VALUES('This is yet another string');

    Correct Answer(s)
    D. INSERT INTO TEST(STR) VALUES('This is another string still');
    E. INSERT INTO TEST(ID) VALUES('This is yet another string');
    Explanation
    The first INSERT command will cause an error because it does not provide a value for the STR column, which is defined as NOT NULL. The second INSERT command will also cause an error because it tries to insert a string value into the ID column, which is defined as a NUMBER.

    Rate this question:

  • 11. 

    Which commands will remove all rows from the table assuming that any filters filter out at least one row?

    • A.

      TRUNCATE TABLE TEST;

    • B.

      DELETE FROM TEST WHERE ID = 1;

    • C.

      TRUNCATE TABLE TEST WHERE ID = 1;

    • D.

      REMOVE TABLE TEST;

    • E.

      DELETE FROM TEST;

    Correct Answer(s)
    A. TRUNCATE TABLE TEST;
    E. DELETE FROM TEST;
    Explanation
    The correct answer is TRUNCATE TABLE TEST; and DELETE FROM TEST;. TRUNCATE TABLE TEST; removes all rows from the table TEST, effectively deleting all the data in the table. DELETE FROM TEST; also removes all rows from the table TEST, but it does so by using a DELETE statement with no WHERE clause, which means it will delete all rows in the table. Both commands achieve the same result of removing all rows from the table.

    Rate this question:

  • 12. 

    Let's assume that a ROLLBACK command is executed after each of the SQL commands listed below. Which of these commands cause the ROLLBACK command to have no effect?

    • A.

      INSERT

    • B.

      CREATE TABLE

    • C.

      CREATE SYNONYM

    • D.

      MERGE

    • E.

      TRUNCATE

    Correct Answer(s)
    B. CREATE TABLE
    C. CREATE SYNONYM
    E. TRUNCATE
    Explanation
    The ROLLBACK command is used to undo transactions and revert any changes made by the SQL commands. In this case, the INSERT and MERGE commands would have made changes to the database, so the ROLLBACK command would undo those changes. However, the CREATE TABLE, CREATE SYNONYM, and TRUNCATE commands do not make any changes to the existing data, so the ROLLBACK command would have no effect on them.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 12, 2010
    Quiz Created by
    Sudha_test
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.