0

databases Online Quiz - 185

Description: databases Online Quiz - 185
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0

Which constraint can be defined only at column level?

  1. unique

  2. not null

  3. check

  4. primary key


Correct Option: B

Which SELECT statement will get the result 'elloworld' from the string 'HelloWorld'?

  1. SELECT SUBSTR ('HelloWorld',1) FROM dual;

  2. SELECT LOWER (TRIM ('H' FROM 'Hello World')) FROM dual

  3. SELECT LOWER (SUBSTR('HellowWorld', 2,1) FROM dual

  4. SELECT INITCAP(TRIM('HellowWorld', 1,1) FROM dual


Correct Option: B

Which substitution variable would you use if you want to reuse the variable without prompting the user each time

  1. &

  2. accept

  3. prompt

  4. &&


Correct Option: D

CREATE USER sh IDENTIFIED BY sh; GRANT CREATE ANY MATERIALIZED VIEW CREATE ANY DIMENSION , DROP ANY DIMENSION , QUERY REWRITE , GLOBAL QUERY REWRITE TO dw_manager WITH ADMIN OPTION; GRANT dw_manager TO sh WITH ADMIN OPTION; Which action the user SH cannot perform?

  1. Create and drop a materialized view

  2. Grant and revoke the role to and from other users

  3. Enable the role and exercise any privileges in the role's privilege domain

  4. Select from a table


Correct Option: D

Which type of index does this syntax create? CREATE INDEX hr.employees_last_name_idx ON hr.employees(last_name) PCTFREE 30 STORAGE(INITIAL 200K NEXT 200K PCTINCREASE 0 MAXEXTENTS 50) TABLESPACE indx;

  1. Bitmap

  2. B-Tree

  3. Partitioned

  4. Reverse key


Correct Option: B

You need to create an index on the PASSPORT_RECORDS table. It contains 10 million rows of data. The key columns have low cardinality. The queries generated against this table use a combination of multiple WHERE conditions involving the OR operator. Which type of index would be best for this type of table?

  1. Bitmap

  2. Btree

  3. Unique

  4. partitioned


Correct Option: A

Which statement about the shared pool is true?

  1. The shared pool CANNOT be dynamically resized.

  2. The shared pool contains only fixed structures

  3. The shared pool consists of the library cache and buffer cache.

  4. The shared pool stores the most recently executed SQL statements and the most recently


Correct Option: D

Which action will cause a log switch?

  1. A transaction completes.

  2. The instance is started.

  3. The instance is shut down

  4. The current online redo log group is filled


Correct Option: D

You examine the alert log file and notice that errors are being generated from a SQL*Plus session. Which files are best for providing you with more information about the nature of the problem?

  1. Control file

  2. User trace files

  3. Background trace files

  4. Initialization parameter files


Correct Option: B
Explanation:

To answer this question, the user needs to have knowledge about the Oracle database architecture and various files associated with it.

The alert log file is a chronological log of messages and errors from an Oracle Database instance. It contains information about database startup and shutdown, log switches, and various error messages.

When errors are being generated from a SQL*Plus session, user trace files and background trace files are the best files to provide more information about the nature of the problem.

User trace files are generated when a user session encounters an error or when a user explicitly requests tracing. These files contain detailed information about the SQL statements executed, as well as any associated errors or warnings.

Background trace files are generated by Oracle background processes, such as the database writer, log writer, and checkpoint processes. These files contain detailed information about the internal workings of the Oracle Database instance, including errors or warnings encountered by the background processes.

Control file and initialization parameter files are essential files for the proper functioning of the Oracle database but are not useful in providing more information about the nature of errors generated from a SQL*Plus session.

Therefore, the correct answer is:

The Answer is: B. User trace files and C. Background trace files

Which is a valid CREATE TABLE statement?

  1. CREATE TABLE EMP9$# AS (empid number(2));

  2. CREATE TABLE EMP*123 AS (empid number(2));

  3. CREATE TABLE PACKAGE AS (packid number(2));

  4. CREATE TABLE 1EMP_TEST AS (empid number(2));


Correct Option: C

A SELECT statement can be to perform these three functions: -Choose rows from a table -Choose columns from a table -Bring together data that is stored in different tables by creating a link between them. Which set of keywords describe these capabilities?

  1. difference,projection,join

  2. selection.projection,join

  3. selection,intersection,join

  4. intersection,projection,join

  5. difference,projection,product


Correct Option: B

Which four are types of functions available in SQL?

  1. string

  2. character

  3. integer

  4. numeric

  5. date

  6. conversion


Correct Option: B,D,E,F

Which object privileges can be granted on a VIEW?

  1. DELETE,INSERT,SELECT

  2. ALTER,DELETE,INSERT,SELECT

  3. DELETE,INSERT,SELECT,UPDATE

  4. none


Correct Option: C

AI Explanation

To answer this question, you need to understand the concept of object privileges and how they apply to views.

In Oracle, object privileges are used to control access to database objects such as tables, views, and procedures. These privileges determine what operations can be performed on the objects, such as selecting, inserting, updating, or deleting data.

When it comes to views, the privileges that can be granted are typically limited to SELECT, INSERT, UPDATE, and DELETE. These privileges determine the operations that can be performed on the underlying tables through the view.

Let's go through each option to understand why it is correct or incorrect:

Option A) DELETE, INSERT, SELECT - This option is incorrect because it does not include the UPDATE privilege, which is one of the privileges that can be granted on a view.

Option B) ALTER, DELETE, INSERT, SELECT - This option is incorrect because the ALTER privilege is not typically granted on views. The ALTER privilege is used to modify the structure of an object, such as adding or dropping columns, which is not applicable to views.

Option C) DELETE, INSERT, SELECT, UPDATE - This option is correct because it includes all the privileges that can be granted on a view. The DELETE, INSERT, SELECT, and UPDATE privileges allow the user to perform the corresponding operations on the underlying tables through the view.

Option D) none - This option is incorrect because it states that no privileges can be granted on a view, which is not true. As mentioned earlier, SELECT, INSERT, UPDATE, and DELETE privileges can be granted on a view.

Therefore, the correct answer is Option C. This option is correct because it includes all the privileges that can be granted on a view.

Which iSQL*PLUS feature can be used to replace values in the WHERE clause?

  1. Substitution variables

  2. Replacement variables

  3. Prompt variables

  4. Instead-of variables

  5. This feature cannot be implemented through iSQL*PLUS


Correct Option: A
Explanation:

To solve this question, the user needs to have knowledge about iSQL*PLUS and its features.

The answer is A. Substitution variables.

Explanation:

Substitution variables can be used to replace values in the WHERE clause of an iSQL*PLUS query. Substitution variables are identified by an ampersand (&) followed by a variable name. When a query is executed, iSQL*PLUS prompts the user to enter a value for each substitution variable. The entered value is then substituted in place of the substitution variable in the query.

Option B, Replacement variables, is not a valid iSQL*PLUS feature.

Option C, Prompt variables, is not a valid iSQL*PLUS feature.

Option D, Instead-of variables, is not a valid iSQL*PLUS feature.

Option E is incorrect because substitution variables can be used in iSQL*PLUS to replace values in the WHERE clause.

Therefore, the correct answer is A. The Answer is: A

You want to display the titles of books that meet these criteria: 1. Purchased before January 21,2001 2. Price is less than $500 and greater than $900 You want to sort the results by thier date of purchase, starting with the most recently bought book. Which statement should you use?

  1. SELECT book_title FROM books WHERE price between 500 and 900 AND puchase_date < '21-JAN-2001' ORDER BY purchase_date;

  2. SELECT book_title FROM books WHERE price IN (500,900) AND puchase_date < '21-JAN-2001' ORDER BY purchase_date ASC;

  3. SELECT book_title FROM books WHERE price <500 or >900 AND puchase_date < '21-JAN-2001' ORDER BY purchase_date DESC;

  4. SELECT book_title FROM books WHERE (price<500 OR price>900) AND puchase_date < '21-JAN-2001' ORDER BY purchase_date DESC;


Correct Option: D

Examine the SQL statements that creates ORDERS table: CREATE TABLE orders (SER_NO NUMBER UNIQUE, ORDER_ID NUMBER, ORDER_DATE DATE NOT NULL, STATUS VARCHAR2(10) CHECK (status IN('CREDIT','CASH')), PROD_ID NUMBER REFERENCES PRODUCTS(PRODUCT_ID), ORD_TOTAL NUMBER, PRIMARY KEY (order_id,order_date)); For which column would an index be automatically created when you execute the above SQL statement?(Choose two)

  1. SER_NO

  2. ORDER_ID

  3. STATUS

  4. PROD_ID

  5. ORD_TOTAL

  6. Composite index on ORDER_ID and ORDER_DATE


Correct Option: A,F

AI Explanation

To determine which column(s) would have an index automatically created when executing the given SQL statement, let's analyze each column in the CREATE TABLE statement:

A. SER_NO - The column SER_NO has the UNIQUE constraint, which automatically creates an index on this column.

B. ORDER_ID - The column ORDER_ID is part of the PRIMARY KEY constraint, but it does not automatically create an index on this column.

C. STATUS - The column STATUS has a CHECK constraint but does not automatically create an index on this column.

D. PROD_ID - The column PROD_ID has a REFERENCES constraint, which does not automatically create an index on this column.

E. ORD_TOTAL - The column ORD_TOTAL does not have any constraints that would automatically create an index on this column.

F. Composite index on ORDER_ID and ORDER_DATE - The PRIMARY KEY constraint on (order_id, order_date) automatically creates a composite index on these columns.

Based on the analysis above, the columns that would have an index automatically created when executing the SQL statement are:

A. SER_NO F. Composite index on ORDER_ID and ORDER_DATE

Therefore, the correct answer is A and F.

In a SELECT statement that includes a WHERE clause, where is teh GROUP BY clause placed in the SELECT statement?

  1. Immediately after the SELECT clause

  2. Before the WHERE clause

  3. Before the FROM clause

  4. After the ORDER BY clause

  5. After the WHERE clause


Correct Option: E

In which case would you use a FULL OUTER JOIN?

  1. Both tables have NULL values

  2. You want all unmatched data from one table

  3. You want all matched data from both tables

  4. You want all unmatched data from both tables

  5. One of the tables has more data than the other

  6. You want all matched and unmatched data from only one table


Correct Option: D

Which two statements accurately describes a role?(Choose two)

  1. A role can be given to a maximum of 1000 users

  2. A user can have access to a maximum of 10 roles

  3. A role can have a maximum of 100 privileges contained in it

  4. Privileges are given to a role by using the CREATE ROLE statement

  5. A role is a named group of related privileges that can be granted to the user

  6. A user can have access to several roles, and several users can be assigned to the same role


Correct Option: D,F

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) A role can be given to a maximum of 1000 users - This option is incorrect because there is no mention of a maximum limit on the number of users a role can be given to.

Option B) A user can have access to a maximum of 10 roles - This option is incorrect because there is no mention of a maximum limit on the number of roles a user can have access to.

Option C) A role can have a maximum of 100 privileges contained in it - This option is incorrect because there is no mention of a maximum limit on the number of privileges a role can have.

Option D) Privileges are given to a role by using the CREATE ROLE statement - This option is correct. The CREATE ROLE statement is used to create a role and assign privileges to it.

Option E) A role is a named group of related privileges that can be granted to the user - This option is incorrect because it describes what a role is, but it does not accurately describe a role in the context of the given statements.

Option F) A user can have access to several roles, and several users can be assigned to the same role - This option is correct. It accurately describes the relationship between users and roles, where a user can have access to multiple roles, and multiple users can be assigned to the same role.

Therefore, the two statements that accurately describe a role are Option D) Privileges are given to a role by using the CREATE ROLE statement and Option F) A user can have access to several roles, and several users can be assigned to the same role.

what are the three main components in Hibernate architecture?

  1. Connection Management

  2. Bean Management

  3. Transaction Management

  4. Object relational mapping

  5. Relational Management


Correct Option: A,C,D
- Hide questions