ADVERTISEMENT
ADVERTISEMENT

MCQ | SQL – Functions

SQL Functions MCQ: This section contains the Multiple-Choice Questions & Answers on SQL Functions.
Submitted by Anushree Goswami, on October 09, 2021

1. In how many parts are the SQL functions are divided into?

  1. 1
  2. 2
  3. 3
  4. 4

Answer: B) 2

Explanation:

SQL functions are divided into 2 parts, Aggregate, and Scalar Functions.


2. ____ value is returned by the SQL Aggregate functions?

  1. Single
  2. Twice
  3. NULL
  4. Infinite

Answer: A) Single

Explanation:

Single value is returned by the SQL Aggregate functions.


3. Select the Aggregate function(s) among the following.

  1. AVG()
  2. FIRST()
  3. LAST()
  4. All of the above

Answer: D) All of the above

Explanation:

AVG(), FIRST() and LAST() are all the aggregate functions.


4. What does AVG() function returns?

  1. First value of the column
  2. Last value of the column
  3. Sum of rows of the table
  4. Average value of the column

Answer: D) Average value of the column

Explanation:

AVG() function returns the Average value of the column.


5. Which function returns the largest value of the column?

  1. MIN()
  2. MAX()
  3. LARGE()
  4. AVG()

Answer: B) MAX()

Explanation:

MAX() function returns the largest value of the column.


ADVERTISEMENT

6. What does COUNT() function returns?

  1. Average value
  2. Largest value
  3. Smallest value
  4. Number of rows

Answer: D) Number of rows

Explanation:

COUNT() function returns the number of rows in the table.


7. Select the function which is not the Scalar Function(s)?

  1. UCASE()
  2. LEN()
  3. SUM()
  4. NOW()

Answer: C) SUM()

Explanation:

SUM() is aggregate function and not the Scalar function.


8. What does UCASE() function do?

  1. Converts database field to uppercase
  2. Converts database field to lowercase
  3. Returns the length of the text field
  4. Returns the current date and time

Answer: A) Converts database field to uppercase

Explanation:

UCASE() function converts database field to uppercase.


9. ____ function extract characters from the text field.

  1. LEN()
  2. NOW()
  3. MID()
  4. FORMAT()

Answer: C) MID()

Explanation:

MID() function extract characters from the text field.


10. Which function returns the correct date and time?

  1. DATE()
  2. NOW()
  3. TIME()
  4. DATETIME()

Answer: B) NOW()

Explanation:

NOW() function returns the correct date and time.


11. In order to merge two or more strings, which string function is used?

  1. CHAR
  2. ALTER
  3. CONCAT
  4. MERGE

Answer: C) CONCAT

Explanation:

In order to merge two or more strings, CONCAT string function is used.


12. We can use literal in the CONCAT function. What does literal refer to?

  1. Number
  2. Character
  3. Date
  4. All of the above

Answer: D) All of the above

Explanation:

Literals are the numbers, characters and the data in the CONCAT function.


13. What is the symbol of Concatenation Operator?

  1. |
  2. ||
  3. //
  4. \\

Answer: B) ||

Explanation:

"||" is the symbol of Concatenation Operator.


14. What is the full form of CTE in SQL?

  1. Character Table Expressions
  2. Character Table Evaluator
  3. Common Table Evaluator
  4. Common Table Expressions

Answer: D) Common Table Expressions

Explanation:

Common Table Expressions is the full form of CTE in SQL.


15. Which clause is needed in CTE SQL syntax?

  1. FOR
  2. AS
  3. WITH
  4. TO

Answer: C) WITH

Explanation:

WITH clause is needed in CTE SQL syntax.


16. In case of ____ data, recursive CTE is used?

  1. Round
  2. Hierarchal
  3. Linear
  4. None of the above

Answer: B) Hierarchal

Explanation:

In case of Hierarchal data, recursive CTE is used.


17. In case the CTE is wrong, it goes into –

  1. Infinite Loop
  2. Null State
  3. False State
  4. True State

Answer: A) Infinite Loop

Explanation:

In case the CTE is wrong, it goes into Infinite Loop.


18. In case to prevent the endless loop in CTE, ____ is added.

  1. MAXLINEAR
  2. MAXROUND
  3. MAXRECURSION
  4. None of the above

Answer: C) MAXRECURSION

Explanation:

In case to prevent the endless loop in CTE, MAXRECURSION is added.


19. From the set of results, in order to remove the duplicate columns, ____ Clause is used.

  1. DUPLICATE
  2. DISTINCT
  3. REMOVE
  4. DROP

Answer: B) DISTINCT

Explanation:

From the set of results, in order to remove the duplicate columns, DISTINCT Clause is used. It is used in conjunction with SELECT keyword.


20. Which of the following statement is TRUE about DISTINCT Clause?

  1. Returns only Distinct values.
  2. Only on the single column, it operates.
  3. It can be used with the aggregates such as COUNT, AVG, etc.
  4. All of the above

Answer: D) All of the above

Explanation:

  1. DISTINCT can return only distinct values.
  2. DISTINCT operates only on the single column
  3. DISTINCT can be used with the aggregates such as COUNT, AVG, etc.

21. ____ are the columns for the retrieval purpose.

  1. Tables
  2. WHERE Conditions
  3. Expressions
  4. None of the above

Answer: C) Expressions

Explanation:

Expressions are the columns for the retrieval purpose.


22. Which of the following statement is TRUE about DISTINCT Clause?

  1. It cannot ignore the NULL values
  2. It can ignore the NULL values
  3. Its query can return multiple values
  4. None of the above

Answer: A) It cannot ignore the NULL values

Explanation:

DISTINCT Clause cannot ignore the NULL values.


23. In order to join N tables, minimum number of join statements required is –

  1. N
  2. N-1
  3. N-2
  4. N+1

Answer: B) N-1

Explanation:

In order to join N tables, minimum number of join statements required is N-1.


24. ____ Clause is used in Parent-child relationship in order to join two or more tables.

  1. FROM
  2. TO
  3. WHERE
  4. IN

Answer: C) WHERE

Explanation:

WHERE Clause is used in Parent-child relationship in order to join two or more tables.


25. The Web SQL API is supported by –

  1. Opera
  2. Google Chrome
  3. Android Browsers
  4. All of the above

Answer: D) All of the above

Explanation:

The WEB SQL API is supported by Opera, Google Chrome and Android Browsers.


26. In order to manage or store the data in the database, WEB SQL Database is used which is a –

  1. Web site
  2. Web page
  3. Web browser
  4. None of the above

Answer: B) Web page

Explanation:

In order to manage or store the data in the database, WEB SQL Database is used which is a Webpage.


27. Which of the following statement is TRUE?

  1. Web API is the part of HTML5
  2. Web API is not the part of HTML5
  3. Web API is the part of HTML
  4. Web API is the part of XHTML

Answer: B) Web API is not the part of HTML5

Explanation:

Web API a separate specification and not the part of HTML5.


28. Select the correct method of Web SQL?

  1. Execute SQL
  2. Transaction
  3. Open Database
  4. All of the above

Answer: D) All of the above

Explanation:

Execute SQL, Transaction and Open Database are all the methods of Web SQL.


29. In order to execute a query in Web SQL, which function is used?

  1. open()
  2. translate()
  3. transaction()
  4. execute()

Answer: C) transaction()

Explanation:

In order to execute a query in Web SQL, db.transaction() is used.


30. Transaction is able to control the following –

  1. Transaction
  2. Commit
  3. Rollback
  4. All of the above

Answer: D) All of the above

Explanation:

Transaction is able to control transaction and rollback or commit.


ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.