0

databases Online Quiz - 114

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

5 + NULL evaluates to 5 and ‘PL/’ || NULL || ‘SQL’ evaluates to ‘PL/SQL’

  1. True

  2. False


Correct Option: B

what is the concatenation operator in dbms_output.put_line() function

  1. +

  2. ||

  3. .


Correct Option: C

what will be the output of the following block: set serveroutput on; declare a int; b int; begin a:=NULL; b:=NULL; if a< b then dbms_output.put_line('y'); else dbms_output.put_line('n'); end if; end;

  1. y

  2. n

  3. error

  4. no output


Correct Option: B

AI Explanation

To answer this question, let's go through the code step by step:

  1. The statement set serveroutput on; enables the output display in Oracle.

  2. The keyword declare is used to declare variables within the block.

  3. The variables a and b of type int are declared.

  4. The value of a and b are set to NULL.

  5. The if statement checks if a is less than b. Since both a and b are NULL, the condition evaluates to NULL.

  6. In Oracle, NULL is considered an unknown value. When comparing NULL with any other value, the result is always NULL.

  7. The else part of the if statement is executed because the condition is not satisfied. It prints 'n' using the dbms_output.put_line function.

  8. Finally, the end if; marks the end of the if statement.

Based on the above explanation, the correct answer is:

Option B) n

which statement is used to break a loop in pl/sql

  1. exit

  2. break

  3. stop

  4. continue


Correct Option: A
  1. fox pro

  2. oracle

  3. db2

  4. sql server


Correct Option: B
  1. SELECT * FROM emp WHERE empid = 493945;

  2. SELECT empid FROM emp WHERE empid= 493945;

  3. SELECT empid FROM emp;

  4. SELECT empid WHERE empid = 56949 AND lastname = ‘SMITH’;


Correct Option: D
Explanation:

To solve this question, the user needs to know the basic syntax of SQL queries. The user must evaluate each query to identify the one that contains an error.

Now, let's go through each option and explain why it is right or wrong:

A. SELECT * FROM emp WHERE empid = 493945;

This statement is correct. It selects all columns from the "emp" table where the "empid" column has a value of 493945.

B. SELECT empid FROM emp WHERE empid= 493945;

This statement is correct. It selects the "empid" column from the "emp" table where the "empid" column has a value of 493945.

C. SELECT empid FROM emp;

This statement is correct. It selects the "empid" column from the "emp" table without any filtering conditions.

D. SELECT empid WHERE empid = 56949 AND lastname = ‘SMITH’;

This statement contains an error. It is missing the "FROM" keyword, which is required to specify the table from which the data should be selected. The correct statement would be "SELECT empid FROM emp WHERE empid = 56949 AND lastname = 'SMITH'".

Therefore, the answer is:

The Answer is: D

The default character for specifying runtime variables in SELECT statements is :-

  1. percentage sign

  2. Quotation marks

  3. Ampersand

  4. Ellipses


Correct Option: C
Explanation:

To solve this question, the user needs to be aware of the syntax used to specify runtime variables in SQL SELECT statements.

The correct answer is:

C. Ampersand

Explanation: In SQL SELECT statements, runtime variables are specified using the ampersand (&) character followed by the variable name. For example, to specify a variable named "dept_name", you would use "&dept_name" in the SELECT statement. This allows users to enter a value for the variable at runtime, rather than hard-coding the value into the query.

Option A (percentage sign) is incorrect, as this character is commonly used as a wildcard operator in SQL, but not for specifying runtime variables.

Option B (quotation marks) is also incorrect, as quotation marks are used to delimit string literals in SQL, but not for specifying runtime variables.

Option D (ellipses) is incorrect, as ellipses are not used in SQL syntax for specifying runtime variables.

Therefore, the correct answer is:

The Answer is: C. Ampersand

Dropping a table has which of the following effects on a nonunique index created for the table?

  1. No effect

  2. The index will be rendered invalid

  3. The index will be dropped

  4. The index will contain NULL values.


Correct Option: C

AI Explanation

To answer this question, we need to understand what happens to a nonunique index when a table is dropped.

Option A) No effect - This option is incorrect because dropping a table does have an effect on the index.

Option B) The index will be rendered invalid - This option is incorrect. When a table is dropped, the index is not rendered invalid. It is either dropped or remains intact.

Option C) The index will be dropped - This option is correct. When a table is dropped, all associated indexes are also dropped. This includes nonunique indexes created for the table.

Option D) The index will contain NULL values - This option is incorrect. Dropping a table does not affect the existing values in the index. Instead, the index itself is either dropped or remains intact.

The correct answer is C) The index will be dropped. This option is correct because when a table is dropped, all associated indexes, including nonunique indexes, are also dropped.

- Hide questions