- MySQL Basics
- MySQL - Home
- MySQL - Introduction
- MySQL - Features
- MySQL - Versions
- MySQL - Variables
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Node.js Syntax
- MySQL - Java Syntax
- MySQL - Python Syntax
- MySQL - Connection
- MySQL - Workbench
- MySQL Databases
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Show Database
- MySQL - Copy Database
- MySQL - Database Export
- MySQL - Database Import
- MySQL - Database Info
- MySQL Users
- MySQL - Create Users
- MySQL - Drop Users
- MySQL - Show Users
- MySQL - Change Password
- MySQL - Grant Privileges
- MySQL - Show Privileges
- MySQL - Revoke Privileges
- MySQL - Lock User Account
- MySQL - Unlock User Account
- MySQL Tables
- MySQL - Create Tables
- MySQL - Show Tables
- MySQL - Alter Tables
- MySQL - Rename Tables
- MySQL - Clone Tables
- MySQL - Truncate Tables
- MySQL - Temporary Tables
- MySQL - Repair Tables
- MySQL - Describe Tables
- MySQL - Add/Delete Columns
- MySQL - Show Columns
- MySQL - Rename Columns
- MySQL - Table Locking
- MySQL - Drop Tables
- MySQL - Derived Tables
- MySQL Queries
- MySQL - Queries
- MySQL - Constraints
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Replace Query
- MySQL - Insert Ignore
- MySQL - Insert on Duplicate Key Update
- MySQL - Insert Into Select
- MySQL Indexes
- MySQL - Indexes
- MySQL - Create Index
- MySQL - Drop Index
- MySQL - Show Indexes
- MySQL - Unique Index
- MySQL - Clustered Index
- MySQL - Non-Clustered Index
- MySQL Operators and Clauses
- MySQL - Where Clause
- MySQL - Limit Clause
- MySQL - Distinct Clause
- MySQL - Order By Clause
- MySQL - Group By Clause
- MySQL - Having Clause
- MySQL - AND Operator
- MySQL - OR Operator
- MySQL - Like Operator
- MySQL - IN Operator
- MySQL - ANY Operator
- MySQL - EXISTS Operator
- MySQL - NOT Operator
- MySQL - NOT EQUAL Operator
- MySQL - IS NULL Operator
- MySQL - IS NOT NULL Operator
- MySQL - Between Operator
- MySQL - UNION Operator
- MySQL - UNION vs UNION ALL
- MySQL - MINUS Operator
- MySQL - INTERSECT Operator
- MySQL - INTERVAL Operator
- MySQL Joins
- MySQL - Using Joins
- MySQL - Inner Join
- MySQL - Left Join
- MySQL - Right Join
- MySQL - Cross Join
- MySQL - Full Join
- MySQL - Self Join
- MySQL - Delete Join
- MySQL - Update Join
- MySQL - Union vs Join
- MySQL Keys
- MySQL - Unique Key
- MySQL - Primary Key
- MySQL - Foreign Key
- MySQL - Composite Key
- MySQL - Alternate Key
- MySQL Triggers
- MySQL - Triggers
- MySQL - Create Trigger
- MySQL - Show Trigger
- MySQL - Drop Trigger
- MySQL - Before Insert Trigger
- MySQL - After Insert Trigger
- MySQL - Before Update Trigger
- MySQL - After Update Trigger
- MySQL - Before Delete Trigger
- MySQL - After Delete Trigger
- MySQL Data Types
- MySQL - Data Types
- MySQL - VARCHAR
- MySQL - BOOLEAN
- MySQL - ENUM
- MySQL - DECIMAL
- MySQL - INT
- MySQL - FLOAT
- MySQL - BIT
- MySQL - TINYINT
- MySQL - BLOB
- MySQL - SET
- MySQL Regular Expressions
- MySQL - Regular Expressions
- MySQL - RLIKE Operator
- MySQL - NOT LIKE Operator
- MySQL - NOT REGEXP Operator
- MySQL - regexp_instr() Function
- MySQL - regexp_like() Function
- MySQL - regexp_replace() Function
- MySQL - regexp_substr() Function
- MySQL Fulltext Search
- MySQL - Fulltext Search
- MySQL - Natural Language Fulltext Search
- MySQL - Boolean Fulltext Search
- MySQL - Query Expansion Fulltext Search
- MySQL - ngram Fulltext Parser
- MySQL Functions & Operators
- MySQL - Date and Time Functions
- MySQL - Arithmetic Operators
- MySQL - Numeric Functions
- MySQL - String Functions
- MySQL - Aggregate Functions
- MySQL Misc Concepts
- MySQL - NULL Values
- MySQL - Transactions
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - SubQuery
- MySQL - Comments
- MySQL - Check Constraints
- MySQL - Storage Engines
- MySQL - Export Table into CSV File
- MySQL - Import CSV File into Database
- MySQL - UUID
- MySQL - Common Table Expressions
- MySQL - On Delete Cascade
- MySQL - Upsert
- MySQL - Horizontal Partitioning
- MySQL - Vertical Partitioning
- MySQL - Cursor
- MySQL - Stored Functions
- MySQL - Signal
- MySQL - Resignal
- MySQL - Character Set
- MySQL - Collation
- MySQL - Wildcards
- MySQL - Alias
- MySQL - ROLLUP
- MySQL - Today Date
- MySQL - Literals
- MySQL - Stored Procedure
- MySQL - Explain
- MySQL - JSON
- MySQL - Standard Deviation
- MySQL - Find Duplicate Records
- MySQL - Delete Duplicate Records
- MySQL - Select Random Records
- MySQL - Show Processlist
- MySQL - Change Column Type
- MySQL - Reset Auto-Increment
- MySQL - Coalesce() Function
PL/SQL Mock Test
This section presents you various set of Mock Tests related to PL/SQL. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
![Questions and Answers](/images/online_mock_tests.png)
PL/SQL Mock Test I
Q 1 - Which of the following is not true about the PL/SQL language?
A - It supports embedded SQL statements.
B - It has all the features of a modern structured programming language.
Answer : C
Q 2 - Which of the following is not true about the PL/SQL language?
A - PL/SQL's general syntax is based on that of ADA and Pascal programming language.
B - Apart from Oracle, PL/SQL is available in TimesTen in-memory database and IBM DB2.
Answer : D
Q 3 - Which of the following is true about the PL/SQL language?
A - PL/SQL provides access to predefined SQL packages.
B - PL/SQL provides support for Object-Oriented Programming.
C - PL/SQL provides support for Developing Web Applications and Server Pages.
Answer : D
Q 4 - Which of the following is not true about the declaration section of a PL/SQL block?
A - This section starts with the DECLARE keyword.
B - It is a mandatory section.
C - It defines all variables, cursors, subprograms, and other elements to be used in the program.
Answer : B
Q 5 - Which of the following is true about the execution section of a PL/SQL block?
A - It is enclosed between the keywords BEGIN and END.
B - It is a mandatory section.
Answer : D
Q 6 - Which of the following is not true about the execution section of a PL/SQL block?
A - It should have more than one executable line of code.
B - It may have just a NULL command to indicate that nothing should be executed.
Answer : A
Q 7 - Which of the following is not true about the exception handling section of a PL/SQL block?
A - This section starts with the EXCEPTION keyword.
B - It is a mandatory section.
C - It contains exception(s) that handle errors in the program.
Answer : B
Q 8 - Which of the following is true about comments in PL/SQL?
A - Comments are explanatory statements.
B - PL/SQL supports both single-line and multi-line comments.
Answer : D
Answer : A
Q 10 - Which of the following is true about data types in PL/SQL?
Answer : D
Q 11 - Which of the following is true about scalar data types in PL/SQL?
A - They hold single values with no internal components.
B - Examples of scalar data types are NUMBER, DATE, or BOOLEAN.
Answer : D
Q 12 - Which of the following is true about character data types and subtypes in PL/SQL?
A - LONG is a variable-length character string with maximum size of 32,760 bytes.
B - ROWID is a physical column identifier, the address of a column in an ordinary table.
C - CHAR is a variable-length character string with maximum size of 32,767 bytes.
D - NCHAR is a variable-length national character string with maximum size of 32,767 bytes.
Answer : A
Q 13 - Which of the following is not true about large object data types and in PL/SQL?
A - BFILE is used to store large binary objects in operating system files outside the database.
B - BLOB is used to store character data in the database.
C - CLOB is used to store large blocks of character data in the database.
D - NCLOB is used to store large blocks of NCHAR data in the database.
Answer : B
Q 14 - What value will be assigned to the variable declared as below −
counter binary_integer;
Answer : C
Q 15 - Consider the following code −
DECLARE -- Global variables num number := 95; BEGIN dbms_output.put_line('num: ' || num1); DECLARE -- Local variables num number := 195; BEGIN dbms_output.put_line('num: ' || num1); END; END;
What will happen when the code is executed?
A - It won’t execute, it has syntax error
B - It will print num: 95 num: 195
Answer : B
Q 16 - What is wrong in the following code?
DECLARE c_id := 1; c_name customers.name%type; c_addr customers.address%type; BEGIN SELECT name, address INTO c_name, c_addr FROM customers WHERE id = c_id; END;
A - You cannot use the SELECT INTO statement of SQL to assign values to PL/SQL variables.
B - The SELECT INTO statement here is wrong. It should be: SELECT c_name, c_address INTO name, addr
C - The WHERE statement is wrong. It should be: WHERE id := c_id;
D - The variable c_id should be declared as a type-compatible variable as −
c_id customers.id%type := 1;
Answer : D
Q 17 - Which of the following is not true about PL/SQL constants and literals?
A - A constant holds a value that once declared, does not change in the program.
B - The CONSTANT declaration cannot impose the NOT NULL constraint.
Answer : B
Q 18 - What will be the output of the following code snippet?
DECLARE a number (2) := 21; b number (2) := 10; BEGIN IF ( a <= b ) THEN dbms_output.put_line(a); END IF; IF ( b >= a ) THEN dbms_output.put_line(a); END IF; IF ( a <> b ) THEN dbms_output.put_line(b); END IF; END;
Answer : C
Q 19 - What would be printed when the following code is executed?
DECLARE x NUMBER; BEGIN x := 5; x := 10; dbms_output.put_line(-x); dbms_output.put_line(+x); x := -10; dbms_output.put_line(-x); dbms_output.put_line(+x); END;
Answer : A
Q 20 - To get the server output result and display it into the screen, you need to write −
Answer : A
Q 21 - Which of the following is not true about PL/SQL decision making structures?
B - The IF statement also adds the keyword ELSE followed by an alternative sequence of statement.
C - The IF-THEN-ELSIF statement allows you to choose between several alternatives.
Answer : D
Q 22 - Which of the following is true about the following code snippet?
DECLARE a number(3) := 100; BEGIN IF (a = 50 ) THEN dbms_output.put_line('Value of a is 10' ); ELSEIF ( a = 75 ) THEN dbms_output.put_line('Value of a is 20' ); ELSE dbms_output.put_line('None of the values is matching'); END IF; dbms_output.put_line('Exact value of a is: '|| a ); END;
B - It will print 'None of the values is matching'.
None of the values is matching
Exact value of a is: 100
Answer : A
Explanation
the ELSIF statement is wrongly written as ELSEIF
Q 23 - Which of the following is true about the following code snippet?
DECLARE a number(3) := 100; BEGIN IF (a = 50 ) THEN dbms_output.put_line('Value of a is 10' ); ELSIF ( a = 75 ) dbms_output.put_line('Value of a is 20' ); ELSE dbms_output.put_line('None of the values is matching'); END IF; dbms_output.put_line('Exact value of a is: '|| a ); END;
B - It will print 'None of the values is matching'.
None of the values is matching
Exact value of a is: 100
Answer : A
Explanation
it has the THEN keyword missing in the ELSIF statement
Q 24 - Which of the following is true about the following PL/SQL CASE statement syntax?
CASE selector WHEN 'value1' THEN S1; WHEN 'value2' THEN S2; WHEN 'value3' THEN S3; ... ELSE Sn; -- default case END CASE;
C - It is you can specify the literal NULL for all the S expressions and the default Sn.
Answer : B
Q 25 - What is the output of the following code?
DECLARE grade char(1) := 'B'; BEGIN case when grade = 'A' then dbms_output.put_line('Excellent'); when grade = 'B' then dbms_output.put_line('Very good'); when grade = 'C' then dbms_output.put_line('Well done'); when grade = 'D' then dbms_output.put_line('You passed'); when grade = 'F' then dbms_output.put_line('Better try again'); else dbms_output.put_line('No such grade'); end case; END;
Answer : C
Answer Sheet
Question Number | Answer Key |
---|---|
1 | C |
2 | D |
3 | D |
4 | B |
5 | D |
6 | A |
7 | B |
8 | D |
9 | A |
10 | D |
11 | D |
12 | A |
13 | B |
14 | C |
15 | B |
16 | D |
17 | B |
18 | C |
19 | A |
20 | A |
21 | D |
22 | A |
23 | A |
24 | B |
25 | C |