0

programming languages Online Quiz - 174

Description: programming languages Online Quiz - 174
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

MAXVALUE is a valid parameter for sequence creation.

  1. True

  2. False


Correct Option: A

Creating a foreign-key constraint between columns of two tables defined with two different datatypes will produce an error.

  1. True

  2. False


Correct Option: A

SELECT (TO_CHAR(NVL(SQRT(59483), “INVALID”)) FROM DUAL is a valid SQL statement

  1. True

  2. False


Correct Option: B

AI Explanation

To answer this question, let's analyze the given SQL statement:

SELECT (TO_CHAR(NVL(SQRT(59483), "INVALID")) FROM DUAL

This SQL statement is not valid. Here's why:

  1. TO_CHAR() function: This function is used to convert a value to a character string. However, in this statement, it is being used on the result of another function or expression, which is missing.

  2. NVL() function: This function is used to replace a null value with a specified value. In this statement, it is being used with the SQRT(59483) expression. However, the SQRT() function is not valid in this context.

  3. SQRT() function: This function is used to calculate the square root of a number. However, in this statement, it is not being used correctly. It should be used with a valid numeric value, but the expression 59483 is not enclosed in single quotes.

  4. "INVALID" string: In this statement, the string "INVALID" is used as a fallback value in case the SQRT() function returns null. However, the use of double quotes instead of single quotes for string literals is not valid in SQL.

Based on these observations, we can conclude that the given SQL statement is not valid (Option B is correct).

The NVL function

  1. Place the alias at the beginning of the statement to describe the table.

  2. Place the alias after each column, separated by white space, to describe the column.

  3. Place the alias after each column, separated by a comma, to describe the column

  4. Place the alias at the end of the statement to describe the table.


Correct Option: C

Issuing the DEFINE_EDITOR=”emacs” will produce which outcome?

  1. The emacs editor will become the SQL*Plus default text editor.

  2. The emacs editor will start running immediately.

  3. The emacs editor will no longer be used by SQL*Plus as the default text editor.

  4. The emacs editor will be deleted from the system.


Correct Option: A

AI Explanation

To answer this question, you need to understand the purpose of the DEFINE_EDITOR parameter in SQL*Plus.

The DEFINE_EDITOR parameter in SQL*Plus is used to define the default text editor that SQL*Plus will use for editing commands or scripts. By default, SQL*Plus uses the operating system's default text editor.

Based on this information, let's go through each option to understand why it is correct or incorrect:

Option A) The emacs editor will become the SQL*Plus default text editor. This option is correct because issuing the DEFINE_EDITOR="emacs" command will set the emacs editor as the default text editor for SQL*Plus. This means that when you use the "EDIT" command in SQL*Plus, it will open the specified command or script in the emacs editor.

Option B) The emacs editor will start running immediately. This option is incorrect. Issuing the DEFINE_EDITOR="emacs" command does not start the emacs editor immediately. It only sets it as the default text editor for SQL*Plus.

Option C) The emacs editor will no longer be used by SQL*Plus as the default text editor. This option is incorrect. Issuing the DEFINE_EDITOR="emacs" command actually sets the emacs editor as the default text editor for SQL*Plus, so it will continue to be used as the default editor.

Option D) The emacs editor will be deleted from the system. This option is incorrect. Issuing the DEFINE_EDITOR="emacs" command does not delete the emacs editor from the system. It only sets it as the default text editor for SQL*Plus.

Therefore, the correct answer is: The emacs editor will become the SQL*Plus default text editor.

Once defined, how long will a variable remain so in SQL*Plus?

  1. Until the database is shut down

  2. Until the instance is shut down

  3. Until the statement completes

  4. Until the session completes


Correct Option: C

AI Explanation

To answer this question, you need to understand the scope of variables in SQL*Plus.

Option A) Until the database is shut down - This option is incorrect. Variables in SQL*Plus are not persistent and do not persist beyond the current session or statement. They are not retained when the database is shut down.

Option B) Until the instance is shut down - This option is incorrect. Similar to option A, variables in SQL*Plus are not persistent and do not persist beyond the current session or statement. They are not retained when the instance is shut down.

Option C) Until the statement completes - This option is correct. Variables in SQL*Plus are only valid for the duration of the current statement. Once the statement is completed, the variables are no longer available.

Option D) Until the session completes - This option is incorrect. Variables in SQL*Plus are only valid within the current session. Once the session is terminated, the variables are lost.

The correct answer is C) Until the statement completes. This option is correct because variables in SQL*Plus are only available for the duration of the current statement. Once the statement is completed, the variables are no longer accessible.

Which of the following options will allow you to drop the user david and all objects in the schema that are associated with that user?

  1. DROP USER david all

  2. DROP USER david schema

  3. DROP USER david cascade

  4. DROP USER david cascade schema


Correct Option: C

identify the meaning of the following SQL statement CREATE USER PETRIE IDENTIFIED EXTERNALLY DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMPS QUOTA 12M ON forms

  1. The user is being validated by the enterprise directory service

  2. The user has unlimited quota on the USERS tablespace.

  3. The user’s quota will never exceed the size of the temporary tablespace.

  4. All options are correct.


Correct Option: B

You are setting up two multiplexed online redo log file groups with three members in each group, how many disks are necessary at minimum?

  1. 3

  2. 0

  3. 1

  4. no disk required


Correct Option: A

What can be said of the following SQL statement? CREATE GLOBAL TEMPORARY TABLE extra_area (startdate DATE, enddate DATE, class CHAR(15)) ON COMMIT DELETE ROWS

  1. It is a session specific table.

  2. It is an invalid SQL statement.

  3. It is only available in Oracle 7

  4. It is a transaction specific table.


Correct Option: D

The database administrator is taking the cbgb tablespace offline, due to erroneous datafiles in the tablespace. Which offline tablespace option should be chosen?

  1. NORMAL

  2. TEMPORARY

  3. IMMEDIATE

  4. FOR RECOVER


Correct Option: B

Which of the following are valid predefined roles that can be used with Oracle databases?

  1. DBA

  2. RESOURCE

  3. CONNECT

  4. EXP_FULL_DATABASE

  5. IMP_FULL_DATABASE

  6. All the above


Correct Option: F

Which of the following role properties would be beneficial if you want to grant privileges to a group of specified users to a certain role?

  1. Reduced privilege administration

  2. Selective availability of privileges

  3. Application awareness

  4. Application-specific security


Correct Option: A

A database administrator needs to create a tablespace for an Oracle database. He formulates the following statement: CREATE TABLESPACE frgr DATAFILE ‘/g01/oracle/data/sasa01.dbf’ SIZE 100M EXTENT MANAGEMENT DICTIONARY AUTOALLOCATE DEFAULT STORAGE ( INITIAL 100K NEXT 100K MINEXTENTS 5 MAXEXTENTS 25 PCTINCREASE 0); LOGGING TEMPORARY

  1. By default, tables within the tablespace will not have all its changes written to redo.

  2. It is a locally managed tablespace.

  3. A temporary tablespace has been created.

  4. An error will be produced; the AUTOALLOCATE parameter should be removed


Correct Option: D

Provide a declaration for i that turns this loop into an infinite loop: while( i != i){ }

  1. String i = "abc"

  2. double i = 0.0/0.0

  3. int i = 3/7

  4. int i = 0


Correct Option: B

Provide a declaration for i that turns this loop into infinite loop: while( i != i + 0){ }

  1. Char i = 9

  2. int i = 3/7

  3. String i = "abc"

  4. int i = 0


Correct Option: C

Is this a legal Java Program? If so, what does it print? \u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0020\u0020\u0020 \u0063\u006c\u0061\u0073\u0073\u0020\u0055\u0067\u006c\u0079 \u007b\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0020\u0020 \u0020\u0020\u0020\u0020\u0073\u0074\u0061\u0074\u0069\u0063 \u0076\u006f\u0069\u0064\u0020\u006d\u0061\u0069\u006e\u0028 \u0053\u0074\u0072\u0069\u006e\u0067\u005b\u005d\u0020\u0020 \u0020\u0020\u0020\u0020\u0061\u0072\u0067\u0073\u0029\u007b \u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074 \u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0020 \u0022\u0048\u0065\u006c\u006c\u006f\u0020\u0077\u0022\u002b \u0022\u006f\u0072\u006c\u0064\u0022\u0029\u003b\u007d\u007d

  1. Its not possible

  2. print some garbage value

  3. compilation error

  4. Hello world


Correct Option: D

What does it print? public class Elementary { public static void main(String[] args) { System.out.println(12345 + 5432l); } }

  1. Compilation error

  2. Runtime error

  3. 17777

  4. 66666


Correct Option: C

What happens when the following code is compiled and run. Select the one correct answer. for(int i = 2; i < 4; i++) for(int j = 2; j < 4; j++) if(i < j) assert i!=j : i;

  1. The class compiles and runs, but does not print anything.

  2. The number 2 gets printed with AssertionError

  3. compile error

  4. The number 3 gets printed with AssertionError


Correct Option: A
- Hide questions