MCQs For NCERT Class 12 Informatics Practices Chapter 1 Querying and SQL Functions

MCQs Class 12

Please refer to the MCQ Questions for Class 12 Informatics Practices Chapter 1 Querying and SQL Functions with Answers. The following Querying and SQL Functions Class 12 Informatics Practices MCQ Questions have been designed based on the latest syllabus and examination pattern for Class 12. Our experts have designed MCQ Questions for Class 12 Informatics Practices with Answers for all chapters in your NCERT Class 12 Informatics Practices book.

Querying and SQL Functions Class 12 MCQ Questions with Answers

See below Querying and SQL Functions Class 12 Informatics Practices MCQ Questions, solve the questions and compare your answers with the solutions provided below.

Question. Which of the following is not a transaction management SQL command ?
a) Commit
b) Savepoint
c) SELECT
d) Rollback

Answer

C

Question. Which of the following command makes the updates performed by the transaction permanent in the database?
a) ROLLBACK
b) COMMIT
c) TRUNCATE
d) DELETE

Answer

B

Question. A relational database can have how many type of keys in a table ?
a) Candidate Key
b) Primary Key
c) Foreign Key
d) All of these

Answer

D

Question. Which function accepts a character string as an input and provides character string or numeric values as an output?
a) Text
b) Date
c) Time
d) Math

Answer

A

Question. Which of the following function returns the value of a number raised to the power of another number?
a) ROUND( )
b) POWER( )
c) POW( )
d) Both (b) and (c)

Answer

D

Question. Which of the following function returns only the day number from month of selected date?
a) DAY(date)
b) DAYNO(date)
c) DAY_NUMBER(date)
d) DATE(date)

Answer

A

Question. Data manipulation language (DML) includes statements that modify the_____ of the tables of database.
a) Structure
b) Data
c) User
d) Size

Answer

B

Question. Aggregate functions can be used in the select list or the ____ clause of the select statement. They cannot be used in a _______ clause.
a) Where, having
b) Having, where
c) Group by, having
d) Group by where

Answer

C

Question. Which of the following is not a text function?
a) TRIM ()
b) TRUNCATE()
c) LEFT()
d) MID ()

Answer

B

Question. What will be returned by the given query? SELECT month(‘2020-05-11’);
a) 5
b) 11
c) May
d) November

Answer

A

Question. The now() function in MySql is an example of ?
a) Math function
b) Text function
c) Date Function
d) Aggregate Function

Answer

C

Question. Which SQL statement lets you find the sales amount for each store ?
a) = SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES ;
b) = SELECT STORE_ID, SUM (SALES_AMOUNT ) FROM SALES ORDER BY STORE_ID;
c) = SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES GROUP BY STORE_ID;
d) = SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES HAVING UNIQUE STORE_ID ;

Answer

C

Question. In SQL, which command(s) is are used to change a table’s storage characteristics?
a) ALTER TABLE
b) MODIFY TABLE
c) CHANGE TABLE
d) All of the above

Answer

A

Question. Which SQL keyword is used to sort the result-set?
a) SORT BY
b) ORDER
c) ORDER BY
d) SORT

Answer

C

Question. Which of the following function is used to FIND the largest value from the given data in MYSQL?
a) MAX ()
b) MAXIMUM ()
c) LARGEST ()
d) BIG ()

Answer

A

Question. A relational database consists of a collection of
a) Tables
b) Fields
c) Records
d) Keys

Answer

A

Question. With SQL, how do you select all the records from a table named “Students” where the value of the column “FirstName” ends with an “a”?
a) SELECT * FROM Students WHERE FirstName =’a’
b) SELECT * FROM Students WHERE FirstName LIKE ‘a%’
c) SELECT * FROM Students WHERE FirstName LIKE ‘%a’
d) SELECT * FROM Students WHERE FirstName =’%a%’

Answer

C

Question. Which of the following group functions ignore NULL values?
a) MAX
b) COUNT
c) SUM
d) All of the above

Answer

D

Question. Which SQL statement do we use to find out how many students took each exam?
a) = SELECT COUNT (DISTINCT STU_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;
b) = SELECT EXAM_ID, MAX(STU_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;
c) = SELECT EXAM_ID, COUNT (DISTINCT STU_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;
d) = SELECT EXAM_ID, MIN(STU_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;

Answer

C

Question. The SQL keyword(s) ________ is used with wildcards
a) NOT IN only
b) LIKE only
c) IN only
d) IN and NOT IN

Answer

B

Question. SQL can be used to:
a) create database structures only.
b) query database data only.
c) modify database data only
d) All of the above can be done by SQL

Answer

D

Question. Which of the following attributes cannot be considered as a choice for Primary Key ?
a) Id
b) License number
c) Dept_Id
d) Street

Answer

D

Question. __________ SQL command changes one or more fields in a record.
a) LOOK-UP
b) INSERT
c) MODIFY
d) CHANGE

Answer

C

Question. SQL command used to modify attribute values of one or more selected type is.
a) Update
b) Modify 
c) Alter
d) Create

Answer

A

Question. Transaction is able to control the following –
a) Transaction
b) Commit
c) Rollback
d) All of the above

Answer

D

Question. Select the function which is not the Scalar Function(s)?
a) UCASE()
b) LEN()
c) SUM()
d) NOW()

Answer

C

Question. Which of the following SQL commands can be used to add data to a database table?
a) ADD
b) UPDATE
c) APPEND
d) INSERT

Answer

D

Question. What will be returned by the given query?
SELECT ROUND(153.669,2);
a) 153.6
b) 153.66
c) 153.67
d) 153.7 

Answer

C

Question. Which of the following is the correct syntax of LCASE( ) function?
a) LCASE(row_name)
b) LCE(column_name)
c) LCASE(str/column_name)
d) None of the above

Answer

C

Question. Which of the following function returns an integer that indicates the position of the first occurrence of the sub-string within the string?
a) INSTR( )
b) RTRIM( )
c) LENGTH( )
d) TRIM( ) 

Answer

A

Question. What will be returned by the given query ?
SELECT INSTR(‘INDIA’, ‘DI’);
a) 2
b) 3
c) −2
d) −3 

Answer

B

Question. The default date format is
a) MM-DD-YYYY
b) YYYY-MM-DD
c) DD-MM-YYYY
d) None of these 

Answer

B

Question. Which function accepts a character string as an input and provides character string or numeric values as an output?
a) Text
b) Date
c) Time
d) Math 

Answer

A

Question. Which of the following function returns only the day number from month of selected date?
a) DAY(date)
b) DAYNO(date)
c) DAY_NUMBER(date)
d) DATE(date)

Answer

A

Question. The correct output of
mysql>SELECT TRIM(LEADING ‘&’ FROM ‘&&& India &&& ‘); 
a) India &&
b) India &&&
c) && India
d) &&& India

Answer

B

Question. Write the output of the following SQL command.
SELECT ROUND (47.89);
a) 47.88
b) 47.8
c) 48.0
d) 50 

Answer

C

Question. Which type of SQL function work with a single-row at a time?
a) Multiple-row functions
b) Single-row functions
c) Both (a) and (b)
d) None of the above

Answer

B

Question. Which of the following function converts the characters of an argument string to the uppercase characters?
a) UCASE( )
b) UPPER( )
c) Both (a) and (b)
d) None of the above

Answer

C

Question. Which of the following function returns the name of the month from selected date?
a) MONTH(date)
b) MONTH_NAME(date)
c) MONTHNAME(date)
d) NAME_MONTH() 

Answer

C

Case Based MCQs :

Shanya Kumar is working with the following table Customers:

She has been given some queries to develop . Help her to achieve the task.
Shanya Kumar is working with the following table Customers : (Put the table)
She has been given some queries to develop. Help her to achieve the task.

Question. Choose the correct query to display the Customer’s name and their respective cities merged together for all the customers whose CNO is ending with 8.
a) mysql>SELECT MERGE(CNAME,CITIES) Customers WHERE CNO LIKE ‘%8’;
b) mysql>SELECT CNAME,CITIES FROM Customers WHERE CNO LIKE ‘%8’;
c) mysql>SELECT CONCAT(CNAME,CITIES) Customers WHERE CNO = ‘%8’;
d) mysql>SELECT CONCAT(CNAME,CITIES) FROM Customers WHERE CNO LIKE ‘%8’;

Answer

C

Question. Choose the correct query to display the length of customer’s name.
a) mysql>SELECT LENGTH(CNAME) FROM Customers;
b) mysql>SELECT LEN(CNAME) FROM Customers;
c) mysql>SELECT COUNT(NAME) FROM Customers;
d) mysql>SELECT COUNT(CNAME) FROM Customers;

Answer

A

Question. Choose the correct query to display the length of customer’s name for those customers whose name end with R or L.
a) mysql>SELECT LEN(CNAME)FROM Customers WHERE CNAME LIKE ‘%R’ OR CNAME LIKE ‘%L’;
b) mysql>SELECT LENGTH(CNAME)FROM Customers WHERE CNAME LIKE ‘%R’ OR CNAME LIKE ‘%L’;
c) mysql>SELECT LENGTH(CNAME)FROM Customers WHERE CNAME = ‘%R’ OR CNAME = ‘%L’;
d) mysql>SELECT LENGTH(CNAME)FROM Customers WHERE CNAME LIKE ‘%R’ OR LIKE ‘%L’;

Answer

B

Question. Choose the correct query to display the left most 4 letters from the customers who lives in Mumbai or Banglore.
a) mysql>SELECT LEFT(CNAME)FROM Customers WHERE CITIES =‘MUMBAI’ OR CITIES = ‘BANGLORE’;
b) mysql>SELECT LEFT(CNAME,3)FROM Customers WHERE CITIES =‘MUMBAI’ OR CITIES = ‘BANGLORE’;
c) mysql>SELECT LEFT(CNAME,4)FROM Customers WHERE CITIES =‘MUMBAI’ OR ‘BANGLORE’;
d) mysql>SELECT LEFT(CNAME,4)FROM Customers WHERE CITIES =‘MUMBAI’ OR CITIES = ‘BANGLORE’;

Answer

D

Question. Choose the correct query to display the city names in lower case letter whose CNO is either C5 or C9.
a) mysql>SELECT UPPERCASE(CITIES)FROM Customers WHERE CNO =‘C5’ OR CNO =‘C9’
b) mysql>SELECT UPPER(CITIES)FROM Customers WHERE CNO =‘C5’ OR ‘C9’
c) mysql>SELECT UPPER(CITIES)FROM Customers WHERE CNO =‘C5’ OR CNO =‘C9’
d) mysql>SELECT UPPER(CITIES)FROM Customers WHERE CNO IS EITHER ‘C5’ OR ‘C9’

Answer

C

Fill in the Blanks

Question: Aggregate Functions cannot be used in __________clause of the Select query. 

Answer

WHERE

Question: The SQL built-in function ____ total values in numeric columns. 

Answer

SUM()

Question: In equi-join, the join condition joins the two tables using _______ operator.  

Answer

=

Question: The SQL built-in function ____ obtains the largest value in a in numeric columns.

Answer

MAX()

Question:  The SQL built-in function ____ obtains the smallest value in a in numeric columns.

Answer

MIN()

Question:  The SQL built-in function ____ computes the average of values in numeric columns.

Answer

AVG() 

Question:  To get a substring of a string other than Substr() function ______ is also used.

Answer

MID()

Question:  The functions that work with one row at a time are _____ _____ functions. 

Answer

SINGLE ROW 

Question:  The SQL built-in function ____ computes the number of rows in a table.

Answer

COUNT() 

Question:  To get day name from a date ____ function is used.  

Answer

DAYNAME()

MCQs For NCERT Class 12 Informatics Practices Chapter 1 Querying and SQL Functions