MariaDB Multiple-Choice Questions (MCQs)

MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system, intended to remain free and open-source software under the GNU General Public License.

MariaDB MCQs: This section contains multiple-choice questions and answers on the various topics of MariaDB. Practice these MCQs to test and enhance your skills on MariaDB.

List of MariaDB MCQs

1. MariaDB supports the fork of ____.

  1. MySQL RDBMS
  2. Oracle
  3. SQL Server
  4. SQLite

Answer: A) MySQL RDBMS

Explanation:

MariaDB supports the fork of MySQL relational database management system (RDBMS).

Discuss this Question


2. Who is the lead developer/CTO of MariaDB ____?

  1. Mårten Mickos
  2. Mark C. Burton
  3. Michael Widenius
  4. All of the above

Answer: C) Michael Widenius

Explanation:

Michael Widenius is the lead developer/CTO of MariaDB who is one of the founders of MySQL AB and the founder of Monty Program AB.

Discuss this Question


3. In MariaDB, what is Maria?

  1. Maria is the nickname of Widenius'
  2. Maria is the name of Widenius' younger daughter
  3. Maria is the name of Widenius' wife
  4. There is no specific reason

Answer: B) Maria is the name of Widenius' younger daughter

Explanation:

MariaDB is named after Widenius' younger daughter, Maria.

Discuss this Question


4. Which is faster MariaDB or MySQL?

  1. MariaDB is faster than MySQL
  2. MySQL is faster than MariaDB
  3. Both are the same
  4. None of the above

Answer: A) MariaDB is faster than MySQL

Explanation:

MariaDB is faster than MySQL based on performing queries or replication.

Discuss this Question


5. Is it possible to replace MySQL with MariaDB?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes, it is possible to replace MySQL with MariaDB.

Discuss this Question


6. Which language is used to write MariaDB Server?

  1. BASIC
  2. C/C++
  3. B
  4. SQL

Answer: B) C/C++

Explanation:

MariaDB Server is written in C/C++ programming language.

Discuss this Question


7. Which command is used to create a database in MariaDB?

  1. CREATE DB
  2. CREATE ST DATABASE
  3. CREATE DATABASE
  4. CREATE NEW DATABASE

Answer: C) CREATE DATABASE

Explanation:

To create a new database in MariaDB, the CREATE DATABASE is used.

Syntax:

CREATE DATABASE Database_Name;

Discuss this Question


8. Which command is used to get the list of existing databases in MariaDB?

  1. USE DATABASES
  2. SHOW DB
  3. GET DATABASES
  4. SHOW DATABASES

Answer: D) CREATE DATABASE

Explanation:

To get the list of existing databases in MariaDB, the SHOW DATABASES is used.

Syntax:

SHOW DATABASES;

Discuss this Question


9. Which command is used to select an existing database in MariaDB?

  1. SELECT
  2. WORKON
  3. USE
  4. USE DATABASE

Answer: C) USE

Explanation:

To select an existing database in MariaDB, the USE is used.

Syntax:

USE database_name;

Discuss this Question


10. Which command is used to drop/delete an existing database in MariaDB?

  1. DROP DATABASES
  2. DROP DB
  3. REMOVE DATABASE
  4. DROP DATABASE

Answer: D) DROP DATABASE

Explanation:

To drop/delete an existing database in MariaDB, the DROP DATABASE is used.

Syntax:

DROP DATABASE database_name;

Discuss this Question


11. We can create a table by using the ____ command and get the list of all existing tables by using the ____ command in MariaDB.

  1. CREATE, USE
  2. CREATE, SHOW
  3. CREATE TABLE, SHOW TABLE
  4. CREATE TABLE, SHOW TABLES

Answer: D) CREATE TABLE, SHOW TABLES

Explanation:

We can create a table by using the CREATE TABLE command and get the list of all existing tables by using the SHOW TABLES command in MariaDB.

Discuss this Question


12. Which command is used to drop/delete an existing table in MariaDB?

  1. DROP TABLE
  2. DROP
  3. DELETE TABLE
  4. DEL TABLE

Answer: A) DROP TABLE

Explanation:

To drop/delete an existing table in MariaDB, the DROP TABLE is used.

Syntax:

DROP TABLE table_name;

Discuss this Question


13. WHERE clauses filter various statements, such as ____.

  1. SELECT
  2. UPDATE
  3. DELETE
  4. INSERT
  5. All of the above

Answer: E) All of the above

Explanation:

WHERE clauses filter various statements, such as SELECT, UPDATE, DELETE, and INSERT.

Discuss this Question


14. In MariaDB, the DELETE statement deletes rows from a given table and returns a ____.

  1. count of the total remaining rows
  2. count of the number of deleted rows
  3. unique records id of the delete row
  4. null value

Answer: B) count of the number of deleted rows

Explanation:

In MariaDB, the DELETE statement deletes rows from a given table and returns a count of the number of deleted rows.

Discuss this Question


15. Which MariaDB function is used to get the number of rows updated, inserted, or deleted by the preceding statement?

  1. COUNT()
  2. UPDATED_ROWS()
  3. ROW_COUNT()
  4. COUNT()

Answer: C) ROW_COUNT()

Explanation:

In MariaDB, the ROW_COUNT() function is used to get the number of rows updated, inserted, or deleted by the preceding statement.

Discuss this Question


16. Which of the following is the correct way to use ROW_COUNT() function?

  1. SELECT ROW_COUNT();
  2. ROW_COUNT();
  3. SELECT * ROW_COUNT();
  4. SHOW ROW_COUNT();

Answer: A) SELECT ROW_COUNT();

Explanation:

The correct way to use ROW_COUNT() function is:

Syntax:

SELECT ROW_COUNT();

Discuss this Question


17. Which of the following clause is used to restrict the number of returned rows?

  1. RESTRICT
  2. FIX
  3. LIMIT
  4. None of the above

Answer: C) LIMIT

Explanation:

MariaDB LIMIT clause is used to restrict the number of returned rows.

Discuss this Question


18. Which of the following query is correct to get the first two names from 'students' table, ordered alphabetically?

  1. SELECT * FROM students ASC LIMIT 2;
  2. SELECT * FROM students LIMIT 2;
  3. SELECT * FROM students ORDER BY name LIMIT 2 ASC;
  4. SELECT * FROM students ORDER BY name LIMIT 2;

Answer: D) SELECT * FROM students ORDER BY name LIMIT 2;

Explanation:

The correct query is to get the first two names from the 'students' table, ordered alphabetically

Syntax:

SELECT * FROM students ORDER BY name LIMIT 2;

Discuss this Question


19. Which statement is used to rename existing MariaDB accounts?

  1. RENAME
  2. RENAME USER
  3. RENAME ACCOUNT
  4. RENAME USERS

Answer: B) RENAME USER

Explanation:

The RENAME USER statement renames existing MariaDB accounts.

Discuss this Question


20. Which statement is used to assign a password to an existing MariaDB user account?

  1. PASSWORD
  2. USER PASSWORD
  3. SET PASSWORD
  4. SET USER PASSWORD

Answer: C) SET PASSWORD

Explanation:

The SET PASSWORD statement assigns a password to an existing MariaDB user account.

Discuss this Question


21. Which of the following is the correct query to delete a password for a user named 'alex'?

  1. SET PASSWORD FOR 'alex'@localhost = PASSWORD("");
  2. SET PASSWORD FOR 'alex'@localhost = null;
  3. DEL PASSWORD FOR 'alex'@localhost;
  4. SET PASSWORD FOR 'alex'@localhost = PASSWORD("null");

Answer: A) SET PASSWORD FOR 'alex'@localhost = PASSWORD("");

Explanation:

The correct query to delete a password for a user named 'alex' is:

Syntax:

SET PASSWORD FOR 'alex'@localhost = PASSWORD("");

Discuss this Question


22. Which statement is used to remove one or more MariaDB roles?

  1. DELETE ROLE
  2. REVOKE ROLE
  3. DROP ROLES
  4. DROP ROLE

Answer: D) DROP ROLE

Explanation:

The DROP ROLE statement removes one or more MariaDB roles.

Discuss this Question


23. Which is not a valid string function in MariaDB?

  1. ASCII()
  2. BIN()
  3. HEX()
  4. LEFTPAD()

Answer: D) LEFTPAD()

Explanation:

The LEFTPAD() is not a valid string function in MariaDB.

Discuss this Question


24. What is the result of the following MariaDB query?

SELECT QUOTE("Don't!");
  1. "Don\'t!"
  2. 'Don\'t!'
  3. Don\'t!
  4. 'Dont!'

Answer: B) 'Don\'t!'

Explanation:

The result of the given query is 'Don\'t!'

Discuss this Question


25. What will QUOTE() function return if we pass NULL in it?

  1. "NULL"
  2. 'NULL'
  3. NULL
  4. null

Answer: C) NULL

Explanation:

The statement QUOTE("NULL") will return NULL. See the example below

Syntax:

SELECT QUOTE(NULL); 
+-------------+
| QUOTE(NULL) |
+-------------+
| NULL        |
+-------------+ 

Discuss this Question


26. The TO_CHAR() function can convert ____ to a string.

  1. date
  2. datetime
  3. time
  4. timestamp
  5. All of the above

Answer: E) All of the above

Explanation:

The TO_CHAR() function can convert an expression of type date, datetime, time, or timestamp to a string.

Discuss this Question


27. What will be the result of the following MariaDB Query?

TO_CHAR('1980-01-11 04:50:39', 'HH24-MI-SS')
  1. 16-50-39
  2. 04-50-39
  3. 1980-01-11
  4. 1980-01-11 04-50-39

Answer: B) 04-50-39

Explanation:

MariaDB Query "TO_CHAR('1980-01-11 04:50:39', 'HH24-MI-SS')" will return "04-50-39".

Discuss this Question


28. Which MariaDB operator is used for Not Equal Operation?

  1. <>
  2. !=
  3. Both A and B
  4. !

Answer: C) Both A and B

Explanation:

Both of the symbols <> and != are used for Not Equal Operations.

Discuss this Question


29. What is the name of this (<=>) Operator?

  1. Join Equal
  2. Multi Equal
  3. Null Check
  4. NULL-safe equal operator

Answer: D) NULL-safe equal operator

Explanation:

<=> is known as "NULL-safe equal operator".

Discuss this Question


30. The output of the MariaDB Query SELECT 'b' BETWEEN 'a' AND 'c';?

  1. True
  2. true
  3. 1
  4. Any of the above

Answer: C) 1

Explanation:

The BETWEEN AND operator returns either 1 or 0.

Discuss this Question


31. Which are the types of joins in MariaDB?

  1. Left Join
  2. Inner Join
  3. Outer Join
  4. Right Join
  5. All of the above

Answer: E) All of the above

Explanation:

All of the above joins are available in MariaDB.

Discuss this Question


32. Which MariaDB operator is used to return the intersection of two or more tables?

  1. UNION
  2. INTERSECT
  3. INTSEC
  4. None of the above

Answer: B) INTERSECT

Explanation:

The INTERSECT operator is used to return the intersection of two or more tables.

Discuss this Question


33. Which MariaDB operator is used to combine the result sets of two or more SELECT statements?

  1. UNION
  2. UNION ALL
  3. INTERSECT
  4. None of the above

Answer: A) UNION

Explanation:

The UNION operator is used to combine the result sets of two or more SELECT statements.

Discuss this Question


34. Which MariaDB operator is used to combine the result sets of two or more SELECT statements without removing duplicate records?

  1. UNION
  2. UNION ALL
  3. INTERSECT
  4. None of the above

Answer: B) UNION ALL

Explanation:

The UNION ALL operator is used to combine the result sets of two or more SELECT statements without removing duplicate records.

Discuss this Question


35. Which is/are the NULL operator(s) in MariaDB?

  1. IS NULL
  2. IS NOT NULL
  3. ISNULL
  4. COALESCE
  5. All of the above

Answer: E) U All of the above

Explanation:

All of the above are the NULL operators for working with NULL values.

Discuss this Question


36. Which is not a large object data type in MariaDB?

  1. mediumblob
  2. tinyblob
  3. char(size)
  4. longtext

Answer: C) char(size)

Explanation:

The char(size) is not a large object data type in MariaDB. The rest of the others are used to store large object-type values.

Discuss this Question


37. Which is the correct MariaDB query to get the list of products that starts with 'Sh'?

  1. SELECT product_name FROM products WHERE product_name REGEXP 'pr__';
  2. SELECT product_name FROM products WHERE product_name REGEXP '^pr';
  3. SELECT product_name FROM products WHERE product_name REGEXP '*pr*';
  4. SELECT product_name FROM products WHERE product_name REGEXP 'pr';

Answer: B) SELECT product_name FROM products WHERE product_name REGEXP '^pr';

Explanation:

The correct MariaDB query to get the list of products that starts with 'Sh' is:

Syntax:

SELECT product_name FROM products WHERE product_name REGEXP '^pr';

Discuss this Question


38. Which is the correct MariaDB query to get the list of products starting with a vowel?

  1. SELECT product_name FROM products WHERE product_name REGEXP '^[aeiou]';
  2. SELECT product_name FROM products WHERE product_name REGEXP '^aeiou';
  3. SELECT product_name FROM products WHERE product_name REGEXP '*[aeiou]*';
  4. None of the above

Answer: A) SELECT product_name FROM products WHERE product_name REGEXP '^[aeiou]';

Explanation:

The correct MariaDB query to get the list of products starting with a vowel is:

Syntax:

SELECT product_name FROM products WHERE product_name REGEXP '^[aeiou]';

Discuss this Question


39. What is the correct query syntax to delete an index in MariaDB?

  1. DROP index_name;
  2. DROP index_name FROM table_name;
  3. DROP INDEX index_name FROM table_name;
  4. DROP INDEX index_name ON table_name;

Answer: D) DROP INDEX index_name ON table_name;

Explanation:

The correct query syntax to delete an index in MariaDB is:

Syntax:

DROP INDEX index_name ON table_name;

Discuss this Question


40. Which MariaDB statement is used to display the list of all indexes?

  1. SHOW INDEX
  2. DISPLAY INDEX
  3. SELECT * INDEX
  4. DESC INDEX

Answer: A) SHOW INDEX

Explanation:

To get the list of all existing indexes associated with a table, we use the SHOW INDEX command.

Syntax:

SHOW INDEX FROM table_name\G

Discuss this Question


41. The ____ keyword within a CREATE TABLE statement spawns a temporary table.

  1. TEMP
  2. TEMPORARY TABLE
  3. TEMPORARY
  4. None of the above

Answer: C) TEMPORARY

Explanation:

The TEMPORARY keyword within a CREATE TABLE statement spawns a temporary table.

Discuss this Question


42. In MariaDB, the ____ attribute is used for generating a unique identity automatically for new rows.

  1. AI
  2. AUTO
  3. AUTO_INCR
  4. AUTO_INCREMENT

Answer: D) AUTO_INCREMENT

Explanation:

In MariaDB, the AUTO_INCREMENT attribute is used for generating a unique identity automatically for new rows.

Discuss this Question


43. Which is the correct MariaDB query for finding the maximum value and grouping the results?

  1. SELECT std_name, MAX(score) FROM students;
  2. SELECT std_name, MAX(score) FROM students GROUP BY std_name;
  3. SELECT std_name, MAX(score) FROM students ORDER BY std_name;
  4. SELECT std_name, MAX(score) FROM students GROUP BY std_name ASC;

Answer: B) SELECT std_name, MAX(score) FROM students GROUP BY std_name;

Explanation:

The correct MariaDB query for finding the maximum value and grouping the results:

Syntax:

SELECT std_name, MAX(score) FROM students GROUP BY std_name;

Discuss this Question


44. Which is the correct MariaDB query syntax to declare a variable having the type of a column from the table?

  1. DECLARE variable_name TYPE OF table_name.column_name;
  2. DECLARE variable_name IN table_name.column_name;
  3. DECLARE variable_name TYPE OF table_name.column_name FROM table_name;
  4. None of the above

Answer: A) DECLARE variable_name TYPE OF table_name.column_name;

Explanation:

The correct MariaDB query syntax to declare a variable having the type of a column from the table is:

Syntax:

DECLARE variable_name TYPE OF table_name.column_name;

Discuss this Question


45. During the variable declaration which keyword is used to get the row data type from the table?

  1. TYPE OF
  2. ROW TYPE
  3. ROW TYPE OF
  4. All of the above

Answer: C) ROW TYPE OF

Explanation:

The ROW TYPE OF keyword is used to get the row data type from the table.

Discuss this Question


46. In MariaDB, a user-defined variable name must be preceded by ____.

  1. #
  2. $
  3. ^
  4. @

Answer: D) @

Explanation:

In MariaDB, a user-defined variable name must be preceded by a single at (@).

Discuss this Question


47. Which function can be used to calculate the age in MariaDB?

  1. TIMESTAMP()
  2. TIMESTAMPS()
  3. TIMESTAMPDIFF()
  4. TIMESTAMPDIF()

Answer: C) TIMESTAMPDIFF()

Explanation:

The TIMESTAMPDIFF() function can be used to calculate the age in MariaDB.

Discuss this Question


48. Which is the correct MariaDB query to lock an existing user?

  1. CREATE USER 'alex'@'localhost' ACCOUNT LOCK;
  2. ALTER USER 'alex'@'localhost' ACCOUNT LOCK;
  3. ALTER USER 'alex'@'localhost' LOCK;
  4. ALTER USER LOCK 'alex'@'localhost';

Answer: B) ALTER USER 'alex'@'localhost' ACCOUNT LOCK;

Explanation:

The correct MariaDB query to lock an existing user is:

Syntax:

ALTER USER 'alex'@'localhost' ACCOUNT LOCK;

Discuss this Question


49. Which is the correct MariaDB query for removing a default role from the current user?

  1. SET DEFAULT ROLE NONE;
  2. SET DEFAULT ROLE NULL;
  3. SET DEFAULT ROLE EMPTY;
  4. SET DEFAULT ROLE REMOVE;

Answer: A) SET DEFAULT ROLE NONE;

Explanation:

The correct MariaDB query for removing a default role from the current user is:

Syntax:

SET DEFAULT ROLE NONE;

Discuss this Question


50. Which is the correct MariaDB query for removing a default role for another user ('alex')?

  1. SET DEFAULT ROLE NONE FOR alex;
  2. SET DEFAULT ROLE NULL FOR alex;
  3. SET DEFAULT ROLE EMPTY FOR alex;
  4. SET DEFAULT ROLE REMOVE FOR alex;

Answer: A) SET DEFAULT ROLE NONE FOR alex;

Explanation:

The correct MariaDB query for removing a default role for another user ('alex') is:

Syntax:

SET DEFAULT ROLE NONE FOR alex;

Discuss this Question


References:




Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.