MCQ Ans
MCQ Ans
SET A
MARKS : 50 Duration :1 hr
1
(a)True (b) False (c)None (d)Null
5 Select the correct output of the code:
a = “abcde”
a [1:1 ] == a [1:2] False
type (a[1:1]) == type (a[1:2]) True
7 What will be the output of the following python statement?
s = "MONGO"
print(sorted(s))
a) "GMNOO" b) ["GMNOO"]
c) ["G","M","N","O","O"] d) Error
8 Identify the output of the following python code:
2
D={1:"one",2:"two", 3:"three"}
L=[]
for k,v in D.items():
if 'o' in v:
L.append(k)
print(L)
4
(i) def Total_Amt(cost = 200, qty,disc= 0.2):
(ii) def Total_Amt(cost= 200, qty=20, disc=2.0):
(iii) def Total_Amt(cost, qty=20,disc=0.2):
(iv) def Total_Amt(cost, qty=20, disc):
a. This is Delhi.
b. This is Delhi. # Delhi is the capital of India. # This is a
comment.
c. This is Delhi. # Delhi is the capital of India.
d. This is Delhi. This is a comment.
17 Which of the following queries contains an error ?
5
SELECT * FROM employee ORDER BY salary , name ;
6
22 Identify the output of the following Python statements.
p = …………………
print(p*2)
8
30 Assertion (A): The HAVING clause in MySQL is used to filter
records after the GROUP BY operation.
Reason (R): The WHERE clause filters records before grouping,
while HAVING allows for conditions on aggregated data. b
31 Evaluate the following expression and identify the correct
answer:
(24 * 3) - 2 % 4 + 8 // 3 + 3**4
number1 = 100
def funct1(x):
global number1
number1 = 200
number1 = number1**x
print(number1)
9
funct1(2)
print(number1)
import random
color = ['Red', 'Orange', 'Yellow', 'Black', 'Cyan']
for c in range(len(color)):
p = random.randint(2,4)
print(color[p],end='$')
a. Red$Red$Cyan$Orange$Yellow$
b. Cyan$Black$Black$Cyan$Yellow$
c. Black$Red$Black$Red$Black$
d. Black$Orange$Yellow$Black$Black$
35 What is the output of the following code snippet?
def flipnumber(L,y):
for i in range(y):
if L[i]%3==0:
L[i]**=3
if L[i]%2==0:
L[i]**=2
L=[3,2,4,8,9]
10
flipnumber(L,5)
for i in L:
print(i,end='#')
import random
temp=[10,20,30,40,50,60]
c=random.randint(0,4)
for i in range(0, c):
print(temp[i],”#”)
a) 10#20# b) 10#20#30#40#50#
c) 10#20#30# d) 50#60#
37 What will be the output of the following code?
def Sum():
global p
p=p+7**2
print(p, end= '#')
p = 10
11
print(p,end= '@')
Sum()
print(p)
12
a)Delete b)Drop c)Truncate d)clear
42 A relational database consists of a collection of_________
a) Tables b) Fields
c) Records d) Keys
43 ____________A(n) in a table represents a logical relationship
among a set of values.
a) Attribute b) Key
c) Tuple d) Entry
44 The command used for modifying the records is:
a) update b) modify
c) alter d) none of the above
45 How many Primary keys can there be in a table?
(a)Only 1 (b)Only 2
(c)Depends on no of Columns (d)Depends on DBA
46 Which operator is used to compare a value to a specified list of
values?
(a)ANY (b)BETWEEN (c)ALL (d)IN
47 Which of the following is true about the HAVING clause?
(a)Similar to the WHERE clause but is used for columns rather
than groups.
(b)Similar to WHERE clause but is used for rows rather than
columns.
13
(c)Similar to WHERE clause but is used for groups rather than
rows.
(d)Acts exactly like a WHERE clause.
48 How can you change "Thomas" into "Michel" in the "LastName"
column in the Users table?
(a)UPDATE User SET LastName = 'Thomas' INTO LastName =
'Michel'
(b)MODIFY Users SET LastName = 'Michel' WHERE LastName =
'Thomas'
(c)MODIFY Users SET LastName = 'Thomas' INTO LastName =
'Michel'
(d)UPDATE Users SET LastName = 'Michel' WHERE LastName
= 'Thomas'
49 When we create a table, we can specify that a column should
not contain null value by using __________ constraint.
14
(a) 3 times, output-13
(b) 3 times,output-12
(c) 4 times,output-11
(d) 4 times,output-12
15