0

programming languages Online Quiz - 330

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

vi is the only text editor available in linux?

  1. True

  2. False


Correct Option: A

tar can be used to write on to floppy disks

  1. True

  2. False


Correct Option: A

if statement needs to end with end if

  1. True

  2. False


Correct Option: B

du command displays the file system usage for the entire file system

  1. True

  2. False


Correct Option: B

top command can be used to control processes

  1. True

  2. False


Correct Option: B

Under which two circumstances do you design database triggers? (Choose two)

  1. a) To duplicate the functionality of other triggers.

  2. b) To replicate built-in constraints in the Oracle server such as primary key and foreign key.

  3. c) To guarantee that when a specific operation is performed, related actions are performed.

  4. d) For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement.


Correct Option: C,D

AI Explanation

To answer this question, you need to understand the purpose and functionality of database triggers. Let's go through each option to understand why it is correct or incorrect:

Option A) To duplicate the functionality of other triggers - This option is incorrect. Triggers are not designed to duplicate the functionality of other triggers. Instead, triggers are used to perform specific actions when certain events occur in the database.

Option B) To replicate built-in constraints in the Oracle server such as primary key and foreign key - This option is incorrect. Built-in constraints such as primary key and foreign key are not replicated using triggers. Constraints are separate database objects that enforce data integrity rules.

Option C) To guarantee that when a specific operation is performed, related actions are performed - This option is correct. One of the main purposes of database triggers is to ensure that when a specific operation (such as an insert, update, or delete) is performed on a table, related actions are automatically performed. These related actions can include updating data in other tables, sending notifications, or performing calculations.

Option D) For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement - This option is correct. Database triggers can be used to perform centralized, global operations that should be executed whenever a specific triggering statement is issued, regardless of the user or application that issues the statement. This allows for consistent and standardized behavior across the database.

The correct answer is C and D. These options correctly describe the circumstances under which database triggers are designed.

Which two statements are true? (Choose two)

  1. a) A function must return a value.

  2. b) A procedure must return a value.

  3. c) A function executes a PL/SQL statement.

  4. d) A function is invoked as part of an expression.

  5. e) A procedure must have a return data type specify in its declaration.


Correct Option: A,D

AI Explanation

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

Option A) A function must return a value - This option is correct because a function is a named PL/SQL block that returns a value. It is designed to perform a specific task and return a value to the caller.

Option B) A procedure must return a value - This option is incorrect because a procedure is a named PL/SQL block that performs a specific task, but it does not have to return a value. Procedures are commonly used to perform actions or modify data without returning a value.

Option C) A function executes a PL/SQL statement - This option is incorrect because a function is not specifically designed to execute PL/SQL statements. It is designed to perform a specific task and return a value.

Option D) A function is invoked as part of an expression - This option is correct because a function can be invoked as part of an expression. For example, you can use a function to calculate a value and assign it to a variable or use it in a calculation.

Option E) A procedure must have a return data type specified in its declaration - This option is incorrect because a procedure does not require a return data type to be specified in its declaration. Procedures are not designed to return a value, so they do not require a return data type.

The correct answers are A and D. A function must return a value, and a function can be invoked as part of an expression.

All users currently have the INSERT privileges on the PLAYER table. You want only your users to insert into this table using the ADD_PLAYER procedure. Which two actions must you take? (Choose two)

  1. a) GRANT SELECT ON ADD_PLAYER TO PUBLIC;

  2. b) GRANT EXECUTE ON ADD_PLAYER TO PUBLIC;

  3. c) GRANT INSERT ON PLAYER TO PUBLIC;

  4. d) GRANT EXECUTE, INSERT ON ADD_PLAYER TO PUBLIC;

  5. e) REVOKE INSERT ON PLAYER FROM PUBLIC;


Correct Option: B,E
  1. a) Only local or packaged sub programs can be overloaded.

  2. b) Overloading allows different functions with the same name that differ only in their return types.

  3. c) Overloading allows different subprograms with the same number, type and order of the parameter.

  4. d) Overloading allows different subprograms with the same name and same number or type of the parameters.

  5. e) Overloading allows different subprograms with the same name but different in either number or type or order of parameter.


Correct Option: A,E
  1. a) Packages can be nested.

  2. b) You can pass parameters to packages.

  3. c) A package is loaded into memory each time it is invoked.

  4. d) The contents of packages can be shared by many applications.

  5. e) You can achieve information hiding by making package constructs private.


Correct Option: D,E
  1. a) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER

  2. b) CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER) RETURN NUMBER

  3. c) CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER)

  4. d) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER(10,2)

  5. e) CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER(10, 2))


Correct Option: A,C
Explanation:

To answer this question, you need to understand the difference between functions and procedures in Oracle SQL. A function is a stored program unit that returns a single value, while a procedure is a stored program unit that can perform multiple actions and return multiple values. Let's go through each option to understand why it is correct or incorrect:

Option A) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER - This option is correct because it is a valid syntax for declaring a function that takes a number parameter and returns a number value.

Option B) CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER) RETURN NUMBER - This option is incorrect because a procedure cannot use the RETURN keyword to specify the return type. A procedure can only use the OUT or IN OUT parameters to return values.

Option C) CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER) - This option is correct because it is a valid syntax for declaring a procedure that takes a number parameter and returns another number value using the OUT parameter.

Option D) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER(10,2) - This option is incorrect because a function cannot use the precision and scale modifiers to specify the return type. A function can only use the data type name to specify the return type.

Option E) CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER(10, 2)) - This option is incorrect because a procedure cannot use the precision and scale modifiers to specify the OUT parameter type. A procedure can only use the data type name to specify the OUT parameter type.

The correct answer is A and C. These options are correct because they are valid syntaxes for declaring a function and a procedure respectively.

Examine this procedure: CREATE OR REPLACE PROCEDURE UPD_BAT_STAT (V_ID IN NUMBER DEFAULT 10, V_AB IN NUMBER DEFAULT 4) IS BEGIN UPDATE PLAYER_BAT_STAT SET AT_BATS = AT_BATS + V_AB WHERE PLAYER_ID = V_ID; COMMIT; END; Which two statements will successfully invoke this procedure in SQL *Plus? (Choose two)

  1. a) EXECUTE UPD_BAT_STAT;

  2. b) EXECUTE UPD_BAT_STAT(V_AB=>10, V_ID=>31);

  3. c) EXECUTE UPD_BAT_STAT(31, 'FOUR', 'TWO');

  4. d) UPD_BAT_STAT(V_AB=>10, V_ID=>31);

  5. e) RUN UPD_BAT_STAT;


Correct Option: A,B
  1. a) An exception cannot propagate across remote procedure calls.

  2. b) An exception raised inside a declaration immediately propagates to the current block.

  3. c) The use of the RAISE; statement in an exception handler reprises the current exception

  4. d) An exception raised inside an exception handler immediately propagates to the enclosing block.


Correct Option: A,C,D

Which statements about JDBC are true? (2 answers)

  1. [_] [a] JDBC is an API to connect to relational-, object- and XML data sources

  2. [_] [b] JDBC stands for Java DataBase Connectivity

  3. [_] [c] JDBC is an API to access relational databases, spreadsheets and flat files

  4. [_] [d] JDBC is an API to bridge the object-relational mismatch between OO programs and relational


Correct Option: B,C

AI Explanation

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

Option A) JDBC is an API to connect to relational-, object- and XML data sources. This statement is incorrect. JDBC is primarily used for connecting to relational databases, not object or XML data sources. For connecting to object or XML data sources, other APIs like JPA (Java Persistence API) or JAXB (Java Architecture for XML Binding) are typically used.

Option B) JDBC stands for Java DataBase Connectivity. This statement is correct. JDBC stands for Java DataBase Connectivity. It is a Java API that provides a standard way to connect to and interact with relational databases.

Option C) JDBC is an API to access relational databases, spreadsheets and flat files. This statement is correct. JDBC can be used to access relational databases, spreadsheets, and flat files. It provides a set of classes and interfaces that enable Java programs to interact with these data sources using SQL queries.

Option D) JDBC is an API to bridge the object-relational mismatch between OO programs and relational. This statement is incorrect. While JDBC allows Java programs to interact with relational databases, it does not specifically address the object-relational mismatch. Object-relational mapping frameworks like Hibernate or JPA are designed to bridge this mismatch.

The correct answers are B) JDBC stands for Java DataBase Connectivity and C) JDBC is an API to access relational databases, spreadsheets and flat files.

  1. O (a) java.jdbc and javax.jdbc

  2. O (b) java.jdbc and java.jdbc.sql

  3. O (c) java.sql and javax.sql

  4. O (d) java.rdb and javax.rdb


Correct Option: C
Explanation:

To answer this question, the user needs to have knowledge about the JDBC (Java Database Connectivity) API and its packages.

Option A: This option is incorrect. There is no package called javax.jdbc in the JDBC API.

Option B: This option is also incorrect. There is no package called java.jdbc.sql in the JDBC API.

Option C: This option is correct. The JDBC API contains two key packages: java.sql and javax.sql.

Option D: This option is incorrect. There is no package called java.rdb or javax.rdb in the JDBC API.

Therefore, the correct answer is:

The Answer is: C. java.sql and javax.sql.

  1. O (a) Type 1 driver

  2. O (b) Type 2 driver

  3. O (c) Type 3 driver

  4. O (d) Type 4 driver


Correct Option: A

Which type of driver converts JDBC calls into the network protocol used by the database management system directly?

  1. O (a) Type 1 driver

  2. O (b) Type 2 driver

  3. O (c) Type 3 driver

  4. O (d) Type 4 driver


Correct Option: D
- Hide questions