MySQL Functions Class 12 MCQ
MySQL Functions Class 12 MCQ
Q1. Single Row Functions are also known as _____
a. Static Functions
b. Scalar Functions
c. Dynamic Functions
d. Vector Functions
Q2. Which of the following are categories of Single Row Function in MySQL?
a. Numeric
b. String
c. Date
d. All of the above
Q3. Which of the following is not a single row function in MySQL?
a. pow( )
b. round( )
c. sum( )
d. mod( )
Q4. Math functions accept ______________ value as input, and return a _____ value as a result
a. Numeric , String
b. String, Numeric
c. Numeric, Numeric
d. Numeric, Date and Time
Q5. String functions accept character value as input, and return ______
a. only numeric values
b. only character values
c. either character or numeric values
d. None of the above
Q6. Which of the following is not a String function in MySQL?
a. Ucase( )
b. Lcase( )
c. Length( )
d. None of the above
Q7. Select pow(x, y); will return _______________
a. x raise to the power y
b. y raise to the power x
c. Both of the above
d. None of the above
Q8. Select pow(9, 0); will return _____
a. 9
b. 0
c. 3
d. 1
Q9. Select pow(0, 0); will return _____
a. 0
b. 1
c. 0.0
d. Error
Q10. Select mod(m, n); will return _______
a. remainder after dividing m by n.
b. remainder after dividing n by m.
c. remainder after dividing m and n by 2.
d. remainder after dividing m by m+n.
MySQL Functions Class 12 MCQ
Click here to test yourself on MySQL Functions Class 12 MCQ Questions Quiz 1
MySQL Functions Class 12 MCQ
Q11. Which of the following SQL command is used to add a new column in a table?
a. Update
b. Alter
c. Change
d. Modify
Q12. Which of the following function is used to change the case of string?
a. Upper
b. Lcase
c. Both of the above
d. None of the above
Q13. Write the output of the statement : select upper(“mysql”);
a. mysql
b. MYSQL
c. MySqL
d. Mysql
Q14. Which of the following function return numeric value?
a. mid( )
b. substr( )
c. instr( )
d. left( )
Q15. Which of the following function help to extract substring from main string?
a. middle( )
b. subst( )
c. substring( )
d. between( )
Q16. ____________ return the number of characters in the specified string.
a. length( )
b. len( )
c. numofchar( )
d. nchar( )
Q17. Which of the following function takes one argument?
a. left( )
b. right( )
c. mid( )
d. trim( )
Q18. _________ function returns the position of the first occurrence of the substring in the given string.
a. instr( )
b. substr( )
c. mid( )
d. trim( )
Q19. Write the output of statement: Select instr(“Informatics”, “ma”);
a. 4
b. 5
c. 6
d. 7
Q20. Which function returns the string after removing leading white space characters.
a. trims( )
b. ltrim( )
c. rtrim( )
d. btrim( )
MySQL Functions Class 12 MCQ
Click here to test yourself on MySQL Functions Class 12 MCQ Questions Quiz 2
MySQL Functions Class 12 MCQ
Q21. Write a query to calculate GST as 10% of Price from Inventory table and display the result after rounding it off to one decimal place.
a. Select round(10/100 * Price, 1) “GST” from Inventory;
b. Select round(10/100 * Price) “GST” from Inventory;
c. Select round(0.01 * Price, 1) “GST” from Inventory;
d. Select roundoff(10/100*Price, 1) “GST” from Inventory;
Q22. Write a query to calculate sum of column Price from table Inventory.
a. Select price(sum) from Inventory;
b. Select sum(price) from Inventory;
c. Select sum(column price) from Inventory;
d. Select sum(price) Inventory;
Q23. Write a query to increase price of all products by Rs100 in table Inventory.
a. update inventory set price = price +100;
b. update table inventory set price = price +100;
c. Alter inventory set price = price +100;
d. update inventory price = price +100;
Q24. Q24. Write a query to add a new column Finaltax of suitable data type to the table inventory.
a. Update table inventory add(Finaltax numeric(7,3));
b. Alter table inventory add(Finaltax numeric(7,3));
c. Alter inventory add(Finaltax numeric(7,3));
d. Update inventory add(Finaltax numeric(7,3));
Q25. Write a query to calculate average of column “Finaltax” in table Inventory.
a. Select average-Finaltax from Inventory;
b. Select avg(Finaltax) Inventory;
c. Select average(Finaltax) from Inventory;
d. Select average(Finaltax column) from Inventory;
Q26. Write a query to display the name of the car(column name “carname”) from table inventory who has maximum amount in “Finaltax” column.
a. Select carname, max(Finaltax) from inventory;
b. Select carname from inventory where Finaltax = max(Finaltax);
c. Select carname from inventory where Finaltax = (Select max(Finaltax) from inventory;
d. Select max(Finaltax) from inventory;
Q27. Write a query to add a new column Commission to the Sale table. The column Commission should have a total length of 7 in which 2 decimal places to be there.
a. Alter table Sale add (Commission Numeric(7,2));
b. Alter table add (Commission Numeric(7,2));
c. Alter table Sale add (Commission Numeric(9,2));
d. Alter Sale add (Commission Numeric(9,2));
Q28. Write a query to display record from Sale table where Commission is more than 20000.
a. Select * from Sale where Commission > 20000;
b. Select * from Sale where Commission >= 20000;
c. Select * from sale having Commission > 20000;
d. Select all records from sale where Commission > 20000;
Q29. Write a query to display InvoiceNo, SalePrice and Commission from Sale table such that commission value is rounded off to 1 digit.
a. Select InvoiceNo, SalePrice, round(Commission, 0) from Sale;
b. Select InvoiceNo, SalePrice, round(Commission, 1) from Sale;
c. Select InvoiceNo, SalePrice, roundoff(Commission, 1) from Sale;
d. Select InvoiceNo, SalePrice, (Commission, 1) from Sale;
Q30. Write a query to display only first alphabet of carname in capital from sale table.
a. select upper(carname) from sale;
b. select upper(left((carname),1)) from sale;
c. select left(carname,1) from sale;
d. select upper(left(carname),1) from sale;
MySQL Functions Class 12 MCQ
Click here to test yourself on MySQL Functions Class 12 MCQ Questions Quiz 3
MySQL Functions Class 12 MCQ
Q31. Identify the aggregate function from the following.
a. mean( )
b. pow( )
c. sum( )
d. total( )
Q32. Which of the following is a text/string function in SQL?
a. now( )
b. mod( )
c. length( )
d. power( )
Q33. Which of the following is not a text function?
a. instr( )
b. left( )
c. now( )
d. length( )
Q34. Write the output of the following:
Select round(2345.6754, 2);
a. 2345
b. 2345.67
c. 2345.68
d. 2345.675
Q35. Write the output of the following:
Select sqrt(round(16.4567));
a. 16
b. 4
c. 4.0
d. Error
Q36. Write the output of the following:
Select month(“2020-05-10”);
a. 5
b. 10
c. 20
d. Error
Q37. ________ function count the number of rows in a table.
a. total( )
b. count(*)
c. show( )
d. select( )
Q38. To display only day part of date __________ function is used.
a. date( )
b. year( )
c. day( )
d. now( )
Q39. ___________ function is used to display system date and time.
a. date( )
b. now( )
c. show( )
d. dayname( )
Q40. avg( ) function is an example of ________
a. single row function
b. text function
c. aggregate function
d. date and time function
MySQL Functions Class 12 MCQ
Click here to test yourself on MySQL Functions Class 12 MCQ Questions Quiz 4
MySQL Functions Class 12 MCQ
Q41. Write the output of following:
select round(2565.7865, -3);
a. 2000
b. 3000
c. 2565.7900
d. 2565.7800
Q42. Write the output of following:
select round(2565.4920, -2);
a. 2600
b. 2500
c. 2000
d. 2565.49
Q43. Which of the following statement may give current year like 2023 or 2024 as output?
a. Select now( );
b. Select day(date(now()));
c. Select year(date(now()));
d. Select date(now());
Q44. Which of the following statement may give 19 as output?
a. Select day(now( ));
b. Select day(date(now()));
c. Both of the above
d. Select year(date(now()));
Q45. Write the command to display the position of ‘m’ in string “Commerce”
a. select instr(“Commerce”,’m’);
b. select substr(“Commerce”,’m’);
c. select mid(“Commerce”,’m’);
d. select trim(“Commerce”,’m’);
Q46. Which command will display first five characters of string “MySQL Practice”?
a. select left(“MySQL Practice”, 4);
b. select right(“MySQL Practice”, 4);
c. select right(“MySQL Practice”, 5);
d. select left(“MySQL Practice”, 5);
Q47. Write the command to extract “SQL” from the string “MySQL Practice”
a. select mid(“MySQL Practice”,3,3);
b. select mid(“MySQL Practice”,3);
c. select mid(“MySQL Practice”,2,3);
d. select mid(“MySQL Practice”,3,2);
Q48. Write the output of the following:
select length(trim(” Computer “)); //3 spaces before and after the word Computer
a. 10
b. 11
c. 14
d. 8
Q49. Write the output of the following:
select power(instr(“2134”,’3′),2);
a. 1
b. 4
c. 9
d. 16
Q50. Write the command to display the remainder on dividing 2 raised to the power 11 by 4.
a. select mod(power(4,11),2);
b. select mod(power(2,11),4);
c. select mod(power(11,2),4);
d. select mod(power(2,4),11);
MySQL Functions Class 12 MCQ
Click here to test yourself on MySQL Functions Class 12 MCQ Questions Quiz 5
MySQL Functions Class 12 MCQ
Q51. Write a statement in SQL to calculate the square of 5.
a. select power(2, 5);
b. select power(5, 2);
c. select power(5, 5);
d. select power(2, 2);
Q52. Write the output of the following:
Select round(945.3951, 3);
a. 945.395
b. 945.396
c. 945.400
d. 945.390
Q53. Write a query to display the different types of “sport” from table “student”.
a. select sport from student;
b. select distinct(sport) from student;
c. select unique(sport) from student;
d. select different(sport) from student;
Q54. Write a query to count the different types of “sport” from table “student”.
a. select count(sport) from student;
b. select count(distinct(sport)) from student;
c. select count(unique(sport)) from student;
d. select count(different(sport)) from student;
Q55. Write the output of the following:
select power(instr(“Communication”, “u”), instr(“Power”,”o”));
a. 16
b. 25
c. 36
d. 125
Q56. Write a statement to display only the first character from column “name” in upper case from table “student”.
a. select upper(name) from student;
b. select upper(name, 1) from student;
c. select upper(left(name, 1)) from student;
d. select upper(right(name, 1)) from student;
Q57. Which statement will display the maximum sales of each area.
a. select max(sales) from shop;
b. select max(sales) group by area from shop;
c. select sales group by area from shop;
d. select max(sales) order by area from shop;
Q58. Write the output of the following:
select pow(3, mod(17,3));
a. 3
b. 9
c. 27
d. 1
Q59. Which of the following query display the system date and time?
a. select now( )
b. select sysdate( )
c. Both of the above
d. None of the above
Q60. Which of the following statement may give “Monday” as output?
a. select day(now( ));
b. select date(now( ));
c. select dayname(now( ));
d. select name(now( ));
MySQL Functions Class 12 MCQ
Click here to test yourself on MySQL Functions Class 12 MCQ Questions Quiz 6
MySQL Functions Class 12 MCQ
Q61. Write the output of the following:
select power(4, 3);
a. 64
b. 81
c. 128
d. 243
Q62. Write the output of the following:
select round(529.8734, 2);
a. 529.88
b. 529.87
c. 529.9
d. 529
Q63. Which of the following is not a mathematical function?
a. power( )
b. round( )
c. mod( )
d. now( )
Q64. Write the output of the following:
Select year(“2003-10-03”) + 3;
a. 2003
b. 2006
c. 2003 + 3
d. Error
Q65. Write the output of the following:
SELECT YEAR(“2003-10-03”) + month(“2003-10-03”);
a. 2003, 10
b. 2006
c. 2013
d. 2010
Q66. Write the output of the following:
Select left(monthname(“2003-10-13”),3);
a. Mar
b. Nov
c. Oct
d. Octo
Q67. Write the output of the following:
SELECT instr(monthname(“2003-10-03”) , right(monthname(“2003-10-03”),1)) ;
a. 1
b. 3
c. 7
d. Error
Q68. Write the output of the following:
select trim(“comm” from “communication”);
a. comm
b. communication
c. unication
d. uni
Q69. Write the output of the following:
select left(trim(“info” from “informatics”),5)
a. rmatics
b. rmati
c. rmatic
d. infor
Q70. Which of the following statement will display names from table ’emp’ starting from alphabet ‘A’.
a. Select name from emp where name like “A%”;
b. Select name from emp where name like “%A”;
c. Select name from emp where name like “_A%”;
d. Select name from emp where name = “A%”;
MySQL Functions Class 12 MCQ
Click here to test yourself on MySQL Functions Class 12 MCQ Questions Quiz 7
MySQL Functions Class 12 MCQ
2. Flow of Control (Loop and Conditional statement)
3. 140+ MCQ on Introduction to Python
4. 120 MCQ on String in Python
7. 100+ MCQ on Flow of Control in Python
8. 60+ MCQ on Dictionary in Python
Important Links
100 Practice Questions on Python Fundamentals
120+ MySQL Practice Questions
90+ Practice Questions on List
50+ Output based Practice Questions
100 Practice Questions on String
70 Practice Questions on Loops
70 Practice Questions on if-else
Disclaimer : I tried to give you the correct MCQ of ”MySQL Functions Class 12 MCQ“ , but if you feel that there is/are mistakes in the MCQ of ”MySQL Functions Class 12 MCQ“ You can directly contact me at csiplearninghub@gmail.com. The above MCQ are created from NCERT Book.