XII_IP_MCQ_Ch3_DBMS & SQL
XII_IP_MCQ_Ch3_DBMS & SQL
18. Jack want to remove leading extra spaces from " Hello
Analysing, Evaluating and
". He has written the code as following but he forgot which
Creating
function to write at the blank space. Complete his code:
SELECT __________(" Hello ");
(a) trim()
(b) ltrim()
(c) rtrim()
(d) left()
(D) RIGHT( )
53. Which of the following function returns the name of the month
Remembering and
from selected date?
Understanding
(A) month(date)
(B) month_name(date)
(C) monthname(date)
(D) name_month()
54. Which of the following function returns only the day number
Remembering and
from month of selected date?
Understanding
(A) day(date)
(B) dayno(date)
(C)day_number(date)
(D)date(date)
55. Help Aman to write the command to display the name of the
Analysing, Evaluating and
traveller whose travel date is in year 2016.
Creating
(A) Select name,tdate from travel where year(tdate)=2016 ;
(B) Select name,tdate from travel where tdate=2016;
(C) Select name,tdate from travel where year(tdate)= =2016;
(D) Select name,max(tdate) from travel
56. You want all dates when any employee was hired. Multiple
Analysing, Evaluating and
employees were hired on the same date and you want to see
Creating
the date only once.
i. SELECT DISTINCT HIREDATE FROM TEACHERS ORDER
BY HIREDATE;
ii. SELECT HIREDATE FROM TEACHERS GROUP BY
HIREDATE; iii. SELECT HIREDATE GROUP BY
HIREDATE HAVING DISTINCT HIREDATE;
Which of the above query is valid?
(A) Query i
(B) Query ii
(C) Query iii.
(D) All of the above.
59. Identify the correct output from the following for given SQL
Applying
statement:
Select CURDATE+10;
(A) 2021-10-14
(B) 2021 10 14
(C) 2021/10/14
(D) None of these
60. Identify the correct output from the following for given SQL
Applying
statement:
Select DATE(‘2021-10-04 01:02:03’);
(A) 2021-10-04 01:02:03
(B) 01:02:03
(C) 2021-10-04
61. The correct return value data type for date function YEAR() is:
Analysing, Evaluating and
(A) integer
Creating
(B) string
(C) float
(D) None of the above
63. Aggregate functions can be used in the select list or the _____
clause of a select statement. They cannot be used in a ______
clause.
(a) Where, having(b) Having, where(c) Group by, having (d)
Group by, where
68. With SQL, how can you return the number of not null record in
the Project field of “Students” table?
(a) SELECT COUNT (Project) FROM Students
(b) SELECT COLUMNS (Project) FROM Students
(c) SELECT COLUMNS (*) FROM Students
(d) SELECT COUNT (*) FROM Students
70. If column “Salary” contains the data set {1000, 15000, 25000,
10000, 15000}, what will be the output after the execution of
the given query?
SELECT SUM(DISTINCT SALARY) FROM EMPLOYEE;
(a)75000 (b) 25000 (c) 10000 (d) 50000
75. The SQL built-in function ____ obtains the smallest value in a
in numeric columns.
77. The SQL built-in function ____ computes the average of values
in numeric columns.
(a) AVG() (b) AVERAGE() (c) Avg() (d) both a and c
79. If column “Age” contains the data set {30, 20, 10, NULL}, what
will be the output after the execution of the given query?
SELECT AVG(Age) FROM EMPLOYEE;
(a)20 (b) 15 (c) Error (d) 0
80. If column “Age” contains the data set {30, 20, 10, NULL}, what
will be the output after the execution of the given query?
SELECT SUM(Age) FROM EMPLOYEE;
(a)0 (b) 50NULL (c) Error (d) 60
81. If column “Age” contains the data set {30, 20, 10, NULL}, what
will be the output after the execution of the given query?
SELECT MIN(Age) FROM EMPLOYEE;
(a)0 (b) NULL (c) 10 (d) Error
82. Which of the following is not a built in aggregate function in
KNOWLEDGE
SQL?
a. AVG()
b. MAX()
c. TOTAL()
83. d. COUNT()
The ____________ aggregation operation adds up all the
KNOWLEDGE
values of the attribute.
a. ADD()
b. AVG()
c. MAX()
d. SUM()
b. SUM()
c. AVG()
d. MIN()
a. 17
b. 18
c. 19
d.20
93. Aggregate Functions are functions that take a
UNDERSTANDING
_________________ as input and return a single value.
a. Collection of Values
b. Single Value
c. Aggregate Value
d. Both a and b
d. DATE()
ON d.dept_id=e.emp_id
GROUP BY d.name
HAVING COUNT (emp_id)>2
a) Filter out all rows whose total emp_id below 2
b) Selecting those rows whose total emp_id>2
c) Filter out all rows whose total emp_id below 2 & Selecting
those rows whose total emp_id>2
d) None of the mentioned
112. If emp_id contain the following set {9, 7, 6, 4, 3, 1, 2}, what will
APPLICATION
be the output on execution of the following MySQL command?
SELECT emp_id
FROM person
ORDER BY emp_id DESC;
a) {9, 7, 6, 4, 3, 1, 2}
b) {1, 2, 3, 4, 6, 7, 9}
c) {2, 1, 3, 4, 6, 7, 9}
d) None of the mentioned
113. If emp_id contain the following set {9, 7, 6, 4, 3, 1, 2}, what will
APPLICATION
be the output on execution of the following MySQL command?
SELECT emp_id
FROM person
ORDER BY emp_id ASC;
a) {9, 7, 6, 4, 3, 1, 2}
b) {1, 2, 3, 4, 6, 7, 9}
c) {2, 1, 3, 4, 6, 7, 9}
d) None of the mentioned
A) DESC
Knowledge
B) ASC
C) There is no default value
D) None of the mentioned
124.
Which of the following is the correct order of a SQL
statement?
A) SELECT
Knowledge
B) WHERE
C) FROM
D) None of the mentioned
Understanding
A) To filter out the row values
B) To filter out the column values
C) To filter out the row and column values
D) None of the mentioned
A) GROUP BY
Knowledge
B) SELECT
C) WHERE
D) Both GROUP BY and WHERE
A) Wildcards
Knowledge
B) Aggregate functions
C) Date functions
D) Joins
A) with aggregates
Understanding
B) with order by
C) without order by
D) without aggregates
A) Group by
Knowledge
B) With
C) Where
D) Having
133.
How to select Maximum Salary of Employee from each
Department ?
A) Group By
Knowledge
B) Order By
C) Both of above
D) None of the above
135. What is the correct format to select Emp_name in
Ascending order ?
A) Sum
Knowledge
B) Count
C) Total
D) Max
140.
Which of the following is True
A) GROUP BY clause
Knowledge
B) WHERE
C) Aggregate functions
D) None
ANSWER
Questi Answer
on No
1. B
2. A
3. A
4. B
5. D
6. C
7. C
8. C
9. D
10. B
11. D
12. A
13. B
14. D
15. B
16. D
17. A
18. B
19. C
20. B
21. D
22. A
23. A
24. A
25. D
26. C
27. A
28. D
29. A
30. A
31. A
32. A
33. B
34. B
35. B
36. B
37. C
38. A
39. B
40. A
41. C
42. C
43. D
44. D
45. B
46. A
47. C
48. C
49. B
50. C
51. A
52. A
53. C
54. A
55. A
56. B
57. A
58. B
59. B
60. C
61. A
62. (a)
63. (b)
64. (b)
65. (a)
66. (d)
67. (d)
68. (a)
69. (c)
70. (d)
71. (d)
72. (b)
73. (b)
74. (d)
75. (c)
76. (a)
77. (d)
78. (a)
79. (a)
80. (d)
81. (c)
82. c: TOTAL()
83. d: SUM()
85. a, WITH()
86. a. DISTINCT
87. a. COUNT(attribute)
90. b. MIN()
91. b. 18
93. b. AVG(Salary)
95. a. values
96. d. 50000
98. c. MAX()
99. c. AVG()
100. d. GROUP BY
105. a) COUNT
107. b) Aggregation of the field “name” of table “department” (“GROUP BY” clause s used
for aggregation of field)
108. c) Filter out all rows whose total emp_id below 2 & Selecting those rows whose
total emp_id>2
(“HAVING” clause are worked similar as “WHERE” clause)
109. a) ORDER BY (“ASC” or “DESC” are used to sort the result set in ascending or
descending order therefore they cannot be used without “ORDER BY” clause)
110. a) Data of emp_id will be sorted in descending order (Keyword “DESC” will sort the data
in descending order)
111. b) Data of emp_id will be sorted in ascending order (Keyword “ASC” will sort the data
in ascending order)
112. a) {9, 7, 6, 4, 3, 1, 2} (“DESC” clause sort the emp_id in the descending order)
113. b) {1, 2, 3, 4, 6, 7, 9} (“ASC” clause sort the emp_id in the ascending order)
114. a) GROUP BY (“ORDER BY”, “DESC”, “ASC” are related to sorting whereas “GROUP BY” is
not related to sorting)
115. b) No error (“ORDER BY” clause can be used with expression such as fed_id, which is a
social security no like 111, 111, 111, therefore, we sort it taking only three digits from
right)
116. b) No error (“ORDER BY” clause can be used with an expression such as fed_id which is
a social security no like 111, 111, 111, therefore, we sort it taking only three digits from
left.)
117. b) No (“ORDER BY” clause can be used with Place holders. Here “2” represent column
“title” and “5” represent “fed_id”. Therefore it looks like “ORDER BY title, fed_id”)
118. D) Joins
119. A) MAX
121. D) HAVING
122. B
123. C
124. B
125. B
126. A
127. A
128. B
129. A
130. B
131. B
132. D
133. D
134. A
135. C
136. C
137. A
138. C
139. C
140. A
141. A
Region- Kolkata
E-mail ID – soumalikroy@gmail.com
Name of the Chapter- DBMS & SQL
Questi Question Content Learning Objective(if Provided)
on No
1. A: The mod function returns the remainder of n divide by
Knowledge and
m.
understanding
R: n and m are numerical.
(a) Both Assertion and reason are true and reason is
correct explanation of assertion.
(b) Assertion and reason both are true but reason is
not the correct explanation of assertion.
(c) Assertion is true, reason is false.
(d) Assertion is false, reason is true.
4. SELECT round(482.624,2);
Knowledge and
A: The above code will give result 482.62
understanding,
nd
R: the 2 argument in round function is a digit which is
not to be rounded off at any place.
Analysing, Evaluating and
(a) Both Assertion and reason are true and reason is
Creating
correct explanation of assertion.
(b) Assertion and reason both are true but reason is
not the correct explanation of assertion.
(c) Assertion is true, reason is false.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
21. Assertion: SUM function does not take the NULL values
KNOWLEDGE
into account while calculating answer.
Reason: SUM function is used to find the Total value of
the Numerical Columns.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
22. Assertion: MIN() and MAX() functions gives the Latest
KNOWLEDGE
and Oldest Dates mentioned in the Database.
Reason: MIN() and MAX functions work with Numbers,
Strings as well as DATES to produce outputs.
23. UNDERSTANDING
Assertion (A): GROUP BY clasue is similar to ORDER BY clause.
Reason (R): GROUP BY and ORDER BY are both used for
aggregation of fields.
A. Both A and R are true and R is the correct explanation of A.
B. Both A and R are true and R is the not the correct
explanation of A.
C. A is true but R is false.
D. A is false but R is true.
24. E. Both A and R are false.
Assertion (A): HAVING clause is similar to WHERE clause but is
UNDERSTANDING
used for groups rather than rows.
Reason (R): The HAVING clause is always used with the GROUP
BY clause and returns the rows where the condition is TRUE.
A. Both A and R are true and R is the correct explanation of A.
B. Both A and R are true and R is the not the correct
explanation of A.
C. A is true but R is false.
25. D. A is false but R is true.
E. Both A and R are false.
Assertion (A): We apply the aggregate function to a group of
UNDERSTANDING
sets of tuples using the group by clause.
Reason (R): We apply the aggregate function to a group of sets
of tuples using the group by clause. The group by clause must
always be used whenever we are willing to apply the
aggregate function to a group of sets of tuples.
A. Both A and R are true and R is the correct explanation of A.
B. Both A and R are true and R is the not the correct
explanation of A.
C. A is true but R is false.
D. A is false but R is true.
E. Both A and R are false.
26. Assertion (A): If we have not specified ASC or DESC after a SQL
UNDERSTANDING
ORDER BY clause, ASC is used by default.
Reason (R): If we have not specified any sorting with the
ORDER BY clause, SQL always uses the ASC as a default sorting
order. SQL treats Null as the lowest possible values while
sorting.
A. Both A and R are true and R is the correct explanation of A.
B. Both A and R are true and R is the not the correct
explanation of A.
27. UNDERSTANDING
Assertion (A): SQL does not permit distinct with count(*).
Reason (R): SQL does not permit distinct with count(*) but the
use
of distinct is allowed with max and min.
A. Both A and R are true and R is the correct explanation of A.
B. Both A and R are true and R is the not the correct
explanation of A.
C. A is true but R is false.
D. A is false but R is true.
E. Both A and R are false.
28. Assertion: Having can be used before Group by
Reason: Having clause sorts columns
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is false.
29.
Assertion: Order by is used to sort rows in SQL
Reason: Order by can be used for Ascending only
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
ANSWER
Question No Answer
1. B
2. A
3. D
4. C
5. B
6. C
7. A
8. A
9. C
10. A
11. A
12. D
13. C
14. D
15. B
16. D
17. D
18. (A) Both Assertion and reason are true and reason is correct explanation of
assertion.
21. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
22. (A) Both Assertion and reason are true and reason is correct explanation of
assertion.
27. B. Both A and R are true and R is the not the correct explanation of A.
28. D
29. B
30. A
31. C
32. A
Region- Kolkata
E-mail ID – soumalikroy@gmail.com
Name of the Chapter- DBMS & SQL
CBQ Question Content Learning
NO Objecti
ve( if
Provided)
1. Raju is a 12 Science student and has created a database "myexp" tables "exp" Knowle
as following for his experiments, dg e
S and
Chemical Amoun underst
Wt Exp_code an ding,
N Applying,
t Analysis
1 Ni_Mh 15 25 Proj1_part1 &
2 Ni_Cd 20 22 Proj1_part2 Evaluati
3 O2_H 60 15 Proj2_part1 on
4 S2H 90 14 Proj2_part2
(2) Raju wants the square values of all Wt values. Which code is correct for
that? (a) SELECT exp(Wt,2) FROM exp;
(b) SELECT power(Wt,2) FROM exp;
(c) SELECT pow(Wt,2) FROM exp;
(d) SELECT square(Wt) FROM exp;
(3) Raju has to divide the "Amount" values by 4 and find the remainders of each
Amount. Which code will be required?
(a) SELECT mod(Amount, 4) FROM exp;
(b) SELECT rem(Amount,4) FROM exp;
(c) SELECT divide(Amount,4) FROM exp;
(d) SELECT mod(Amount/4) FROM exp;
2. Shruti has some data of her friends as following with table name Knowle
"FR" SN Name City State dg e
1 Priyanka Nasik Maharashtra and
2 Shibangi Bhopal Madhya Pradesh underst
3 Sheetal Baroda Gujarat an ding,
Applying
,
4 Ragini
5 Nandini
6 Nivedita
(2) What will be the output of this code: SELECT Name from FR WHERE
left(Name,2)="Sh";
(a) (b)
(c) (d)
(3) Which code will display the records of friends of Maharashtra and Madhya
Pradesh?
(a) SELECT * FROM FR WHERE State="M";
(b) SELECT * FROM FR WHERE State.left="M";
(c) SELECT left(State) FROM FR WHERE "M";
(d) SELECT * FROM FR WHERE left(state,1)="M";
(4) What is the output of this code: SELECT city FROM FR WHERE
instr(city,"o")>0; (a) (b)
(c) (d)
3. There was a survey on primary class students and the data is as following table Knowle
"survey" SN Name edu food Sports_TV_cyclin g dg e
1 Mohit 8 8 Y_N_Y and
2 Chikoo 9 7 N_Y_Y underst
3 Mittal 7 7 N_Y_N an ding,
4 Raju 8 9 Y_N_N Applying,
5 Kiran 9 8 Y_Y_Y Analysis
&
Answer the follwing questions based on the above data Evaluati
(1) The survey was organized in 2020 and the edu values are expected to be squared on
on 2021 survey. So which code is correct to display the 2021 survey prediction of edu?
(a) SELECT exp(edu,2) FROM survey;
(b) SELECT pow(edu,2) FROM survey;
(c) SELECT square(edu) FROM survey;
(d) SELECT sqr(edu) FROM survey;
(4) Which code is correct to Display the records whose TV value is N and cycling value
is N.
(i) SELECT * FROM survey WHERE
right(sports_TV_cycling,3)="N_N"; (ii) SELECT * FROM survey
WHERE mid(sports_TV_cycling,3,3)="N_N";
(a) Only i
(b) Only ii
(c) Both i, ii
(d) None of the above
4. Read the passage given below and answer the following questions: Learni
Vikas has inserted a table Hospital in SQL. Help him to perform the following ng
operations: Patient_No Patient_Name Disease Object
P001 Alya Viral Fever ive
P002 Kavita Cough
6. ABC Company has a created a table EMPLOYEES in SQL to store the details of Applic
their employees. The structure of the table is given below: ati on
EmpID EmpName Salary
121 Ravi 10000
123 Sam 12000
124 Anya 11500
(i) Which command the company should apply on table to get first three characters
from the names of every employee.
(A) Select UPPER(EmpName) from EMPLOYEES;
(B) Select LEFT(EmpName,3) from EMPLOYEES;
(C) Select RIGHT(EmpName,3) from EMPLOYEES;
(D) Select MID(EmpName) from EMPLOYEES;
(ii) Suggest a command to the company for finding out the last 2 characters from
the names of every employee.
(A) Select UPPER(EmpName,2) from EMPLOYEES;
(B) Select LEFT(EmpName,2) from EMPLOYEES;
(C) Select RIGHT(EmpName,2) from EMPLOYEES;
(D) Select MID(EmpName,2) from EMPLOYEES;
(iii) Which of the following command the company can use to extract substring “av”
from employee name “Ravi”
(A) Select UPPER(EmpName,2) from EMPLOYEES WHERE EmpID=121;
(B) Select SUBSTR(EmpName,2,2) from EMPLOYEES WHERE
EmpID=121; (C) Select MID(EmpName,1,2) from EMPLOYEES WHERE
EmpID=121; (D) Select MID(EmpName,2,2) from EMPLOYEES;
(iv) Which command can be used to find the number of characters in each
employee name.
(A) Select LENGTH(EmpName) from EMPLOYEES;
(B) Select LEFT(EmpName) from EMPLOYEES;
(C) Select RIGHT(EmpName,2) from EMPLOYEES;
(D) Select MID(EmpName,2) from EMPLOYEES;
7. Consider the given relation Hospital and answer the questions given below:
8. Table: Hospital
2.How can you display the departments and no of patients in each department but you will
only display the departments having more than one patient.
a) select department, count(*) from hospital where count(department)>1;
b) select department, count(*) from hospital where count(department)>1 group by
department; c) select department, count(*) from hospital group by department where
count(department)>1; d) select department, count(*) from hospital group by department
having count(*)>1;
9. A School in Delhi uses database management system to store student details. The UNDE
school maintains a database 'school_record' under which there are two tables. Student R
Table : Maintains general details about every student enrolled in school. StuLibrary STAN
Table : To store details of issued books. BookID is the unique identification number DI NG
issued to each book. Minimum issue duration of a book is one Day. APPLI
C
ATIO
N,
EVALU
ATION
1.Identify the SQL Query which displays the data of the total number of books
issued. a. SELECT COUNT(BookID) FROM StuLibrary
b. SELECT COUNT(StuID) FROM StuLibrary
c. SELECT COUNT(*) FROM StuLibrary
d. Both a and c
2.Which of the following code will display the number of unique students who
have issued one or more Books from the Library.
3.Which SQL Query will find the latest date on which a book was
returned. a. SELECT MAX(Return_date) FROM StuLibrary
b. SELECT MIN(Return_date) FROM StuLibrary
c. SELECT LAST(Return_date) FROM StuLibrary
d. SELECT SUM(Return_date) FROM StuLibrary
4.Which code will count the number of students whose name starts with
‘SH’ a. SELECT COUNT(StuName LIKE “SH%”) FROM Student
b. SELECT COUNT(StuName) FROM Student
WHERE StuName = ‘SH%’
c. SELECT COUNT(StuName) LIKE ‘SH%’ FROM Student
d. SELECT COUNT(StuName) FROM Student WHERE StuName LIKE ‘SH%’
5.Select the code to count the No. of Books issued by each student.
a. SELECT StuID, COUNT(BookID) FROM StuLibrary GROUP BY Book
ID b. SELECT StuID, COUNT(BookID) FROM StuLibrary GROUP BY
StuID c. SELECT StuID, COUNT(StuID) FROM StuLibrary GROUP BY
StuID d. SELECT BookID, COUNT(StuID) FROM StuLibrary GROUP BY
BookID
10. Tejasvi Sethi, a car dealer has stored the details of all cars in her showroom in a table UNDE
called CARMARKET. The table CARMARKET has attributes CARCODE which is a R
primary key, CARNAME, COMPANY, COLOR, COST (in lakh rupees) of the car and STAN
DOM which is the Date of Manufacture of the car. DI NG
Answer any four questions based on the table CARMARKET from the below APPLI
mentioned questions. C
Table: CARMARKET ATIO
CAR N,
CAR EVALU
COMPANY COLOR COST DOM ATION
CODE
NAME
C01 BALENO SUZUKI BLUE 5.90 2019-11-07 CO2 INDIGO TATA
SILVER 12.90 2020-10-15 C03 GLC MERCEDES WHITE 62.38
2020-01-20 C04 A6 AUDI RED 58.55 2018-12-29
5.Display the count of those cars who have more than one cars of same color. a.
SELECT COUNT(*) FROM CARMARKET WHERE COUNT(COLOR)> 1 b.
SELECT COUNT(COLOR) FROM CARMARKET GROUP BY COLOR c.
SELECT COUNT(COLOR) FROM CARMARKET GROUP BY COLOR HAVING
COUNT(COLOR)> 1
d. None of the Above.
11. Consider the table STUDENT given below and give answers to the questions UNDE
R
STAN
DI NG
APPLI
C
ATIO
N,
EVALU
ATION
1.Pinky has given the following command to obtain the highest marks
class-wise: SELECT MAX (Marks) FROM STUDENT WHERE GROUP BY
Class; but she is not getting the desired result. Help her by writing the correct
command (a) SELECT MAX (Marks) FROM STUDENT WHERE GROUP
BY Class; (b) SELECT Class, MAX (Marks) FROM STUDENT GROUP BY
Marks; (c) SELECT Class, MAX (Marks) GROUP BY Class FROM
STUDENT; (d) SELECT Class, MAX (Marks) FROM STUDENT GROUP
BY Class;
2.State the command to display the average marks scored by students of each gender
who are in Class XI.
(i) SELECT Gender, AVG (Marks) FROM STUDENT WHERE Class- "XI" GROUP
BY Gender;
(ii) SELECT Gender, AVG (Marks) FROM STUDENT GROUP BY Gender
WHERE Class-"XI";
(iii) SELECT Gender, AVG (Marks) GROUP BY Gender FROM STUDENT
HAVING Class-"XI";
(iv) SELECT Gender, AVG (Marks) FROM STUDENT GROUP BY Gender
HAVING Class = "XI";
Choose the correct option:
(a) Both (ii) and (iii)
(b) Both (ii) and (iv)
(c) Both (i) and (iii)
(d) Only (iii)
3.Help Ritesh write the command to display the name of the youngest
student (a) SELECT Name, MIN (DOB) FROM STUDENT;
(b) SELECT Name, MAX (DOB) FROM STUDENT;
(c) SELECT Name, MIN (DOB) FROM STUDENT GROUP BY
NAME; (d) SELECT Name, MAXIMUM (DOB) FROM STUDENT;
12. Mr Mukesh Prasad a teacher by profession created a table named ASSIGNMENT to keep KNOWLE
DGE
record of the assignment given to his student :
ASSIGNMENT
AsnNo Date Topic SubDate Grade Marks TotalQ ues
12 2014-10-23 Greenhouse Gas 2014-10-27 5 15 3 13 2014-10-28 Methane
2014-11-05 10 15 5 14 2014-11-07 Chlorophyl 2014-11-10 5 10 2 15
2014-11-12 Respiration 2014-11-18 10 12 3 16 2014-11-20 Reproduction
2014-11-23 5 15 5 17 2014-12-28 Electricity NULL 5 15 3 20 2015-01-15
Chemical Bonding 2015-01-20 5 10 2 21 2015-01-17 Carbon NULL 10 10 2
1.Mr. Mukesh Prasad needs a help from you to display the list of recent topics to old topics
of assignments. Which command you will select among the following:
A) SELECT Topic FROM ASSIGNMENT ORDER BY Date desc;
B) SELECT * FROM ASSIGMENT ORDER BY date desc;
C) SELECT ASSIGNEMENT ORDER BY date desc;
D) SELECT ALL FROM ASSIGNMENT ORDER BY Date desc;
2.Which command Mr. Mukesh Prasad to make a group of different topics depanding on
total question.
A) SELECT ALL FROM ASSIGNMENT GROUPED BY TOTAL
QUESTION. B) SELECT * FROM ASSIGNMENT GROUPED BY TOTAL
QUESTION C) SELECT ASSIGMENT GROUPED BY TOTAL UESTION
D) SELECT * FROM ASSIGMENT GROUPED AS TOTAL QUESTION
15. STUDENT
Rollno Name Class DOB Gender City Marks 1 anand xi 6/6/1997 m agra 430 2
Chetan xii 7/5/1994 m Mumbai 460 3 geet xi 6/5/1997 f agra 470 4 preeti xii Under
8/8/1995 f Mumbai 492 5 saniyal xii 8/10/1995 m delhi 360 5 saniyal xii sta
8/10/1995 m delhi 360 6 maakhiy xi 12/12/1994 f dubai 256 7 neha x 8/12/1995 nding,
f Moscow 324 8 nishant x 12/6/1995 m moscow 429 Prachi has given the Applic
following command to obtain the highest marks ati on,
Select max(marks) from student where group by class; but she is not getting the Creatio
n
desired result. Help her by writing the correct command.
A) Select max(marks) from student where group by class;
B) Select class, max(marks) from student group by marks;
C) Select class, max(marks) group by class from student;
D) Select class, max(marks) from student group by class;
ANSWER
CBQ NO Answer
1. 1.B
2.C
3.A
4.D
2. 1.A
2.B
3.D
4.B
3. 1.B
2.D
3.C
4.C
4. 1.B
2.A
3.A
4.B
5. 1.B
2.C
3.B
4.A
6.
1.B
2.A
3.A
4.B
2.D
3.D
9. i. d. Both a and c
ii. c. SELECT COUNT(DISTINCT StuID) FROM
StuLibrary iii. a. SELECT MAX(Return_date) FROM
StuLibrary iv. d. SELECT COUNT(StuName) FROM
Student WHERE StuName LIKE ‘SH%’
v. b. SELECT StuID, COUNT(BookID) FROM
StuLibrary GROUP BY StuID
12.
A) SELECT Topic FROM ASSIGNMENT ORDER BY Date
desc; B) SELECT * FROM ASSIGNMENT GROUPED BY
TOTAL QUESTION
13. B
14. B
15. D
Region- Kolkata
21. NOW() is used to see the current date only. Remembering and
Understanding
22. The month() function returns the month number from the
Remembering and
selected date.
Understanding
29. The sysdate() function returns the date with the exact time
Applying
when the command is executed.
30. The now() function returns the date with constant time
Remembering and
after execution.
Understanding
31. MIN and MAX can only be used with numeric columns.
35. COUNT () function ignores null values while counting the records.
45. Multiple Row function is also known as Scalar Function KNOWLEDGE SUM()
UNDERSTANDING
47.
records in the Table
Argument type of AVG() function can be numeric or
48.
KNOWLEDGE
49. string data type
DISTINCT keyword works with COUNT(*) function UNDERSTANDING
50.
HAVING Clause only takes conditions on Aggregate
KNOWLEDGE
Function.
An Aggregate function will return multiple rows of
KNOWLEDGE
output only when used with GROUP BY Clause.
51. We can also use the GROUP BY statement on more than one
KNOWLEDGE
column.
A) True
B) False
54. Where filters data before grouping and Having filters data
KNOWLEDGE
after grouping
A) True
B) False
55. Similar to the WHERE clause, the HAVING clause requires that
KNOWLEDGE
the column names that appear in the clause must also appear
A) True
Knowledge
B) False
Understanding
ANSWER
Question No Answer
1. True
2. False
3. False
4. False
5. True
6. True
7. True
8. False
9. True
10. False
11. FALSE
12. FALSE
13. TRUE
14. TRUE
15. TRUE
16. TRUE
17. FALSE
18. FALSE
19. TRUE
20. TRUE
21. FALSE
22. TRUE
23. TRUE
24. FALSE
25. FALSE
26. FALSE
27. TRUE
28. FALSE
29. TRUE
30. TRUE
31. False
32. True
33. False
34. False
35. True
36. False
37. True
38. True
39. True
40. False
41. TRUE
42. TRUE
43. FALSE
44. TRUE
45. FALSE
46. FALSE
47. FALSE
48. FALSE
49. FALSE
50. TRUE
51. A)True
52. A)True
53. A)True
54. B)False
55. A)True
56. A)True
57. A)True
58. B)False
59. B)False
60. A)True
61. A
62. A
63. A
64. B
65. A
66. B
67. A
68. A
69. B
70. B
Region- Kolkata
E-mail ID – soumalikroy@gmail.com