0% found this document useful (0 votes)
19 views15 pages

MCQ Ans

The document is an MCQ exam paper for XII Computer Science students at Cauvery Global Senior Secondary School, covering topics such as Python programming, SQL commands, and data structures. It consists of 50 questions with various formats including true/false, multiple choice, and assertions. The exam is designed to assess students' understanding of computer science concepts within a one-hour duration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views15 pages

MCQ Ans

The document is an MCQ exam paper for XII Computer Science students at Cauvery Global Senior Secondary School, covering topics such as Python programming, SQL commands, and data structures. It consists of 50 questions with various formats including true/false, multiple choice, and assertions. The exam is designed to assess students' understanding of computer science concepts within a one-hour duration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

CAUVERY GLOBAL SENIOR SECONDARY SCHOOL

XII - COMPUTER SCIENCE-MCQ

SET A
MARKS : 50 Duration :1 hr

1 State True or False:


“In a Python loops can also have else clause”-TRUE
2 In SQL, which command(s) is/are used to change a table’s
structure/characteristics?

(a) ALTER TABLE (b) MODIFY TABLE


(c) CHANGE TABLE (d) All of these
3 Given a tuple Tup1=(25,35,43,22,13,56,45,78,90) Identify the
statement from the list below that will produce the result as
(25,43,13,45,90)

(a) print(Tup1[::]) (b) print(Tup1[0:9:1])


(c) print(Tup1[::2]) (d) print(Tup1[2:0:9])
4 Consider the given expression:

17%5==2 and 4%2>0 or 15//2==7.5

Which of the following will be the correct output if the given


expression is evaluated?

1
(a)True (b) False (c)None (d)Null
5 Select the correct output of the code:

s = "Question paper 2022-23"


s= s.split('2')
print(s)

a. ['Question paper ', '0', '', '-', '3']


b. ('Question paper ', '0', '', '-', '3')
c. ['Question paper ', '0', '2', '', '-', '3']
d. ('Question paper ', '0', '2', '', '-', '3')
6 What will be the output of following code if

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)

(a) [1,2] (b) [1,3] (c)[2,3] (d)[3,1]


9 Consider a tuple T1=(2,3,{1:‘One’,2:‘Two’,3:‘Three’})

Identify the statement that will result in an error.

(a) print(T1[3]) (b) print(T1[0])


(c) print(2 in T1) (d) print(len(T1))
10 Which of the following commands is not a DDL command?

(a) DROP (b) DELETE


(c) CREATE (d) ALTER

11 Consider the code given below:


b=5
def myfun(a):
____________# missing statement.
b=b*a
3
myfun(14)
print(b)

Which of the following statements should be given in the blank


for # Missing statement, if the output produced is 70?

a. global a b. global b=70


c. global b d. global a=70
12 SUM(), AVG() and COUNT() are examples of functions.

a) single row functions b) aggregate functions


c) math function d) date function
13 Which operator can take wild card characters for query
conditions?
(a) BETWEN (b) LIKE (c) IN (d) NOT
14 Identify the incorrect statement regarding passing parameters
to functions.
a)You can pass keyword arguments in any order.
b)You can pass positional arguments in any order.
c)You can pass both positional and keyword arguments
together.
d)An argument list must have any positional arguments
followed by any keyword arguments.
15 Identify the correct statement regarding declaration of default
parameters in the function header.

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) Only (ii) (b) Both (ii) and (iii)


(c) Both (i) and (iii) (d) Both (ii) and (iv)
16 What will be the output of this Python line?

print("This is Delhi. # Delhi is the capital of India.") # This is a comment.

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 ?

(a) Select * from emp where empid=10003;


(b) Select empid from emp where empid=10006;
(c) Select empid from emp;
(d) Select empid where empid=10009 and lastname= ‘GUPTA’;
18 Consider the following query

5
SELECT * FROM employee ORDER BY salary , name ;

To display the salary from greater to smaller and name in


alphabetical order, which of the following options should be
used ?

(a) Ascending, Descending (b) Asc, Desc


(c) Desc, Asc (d) Descending, Ascending
19 Which of the following requirements can be implemented using
a CHECK constraint?

(a) Student must be greater than 18 years old.


(b) Student must be from a BRICS Country (Brazil, Russia,
India, China, South Africa)
(c) Student’s roll number must exist in another table(say,
namely Eligible)
(d) None of these
20 All aggregate functions ignore NULLs except for the function.

(a)Sum() (b) Count(*)


(c) Average() (d) None of these
21 In which mode are Python instructions stored in a file with .py
extension?
(a) Script mode (b) Run mode
(c) Interactive mode (d) All of these

6
22 Identify the output of the following Python statements.

lst1 = [10, 15, 20, 25, 30]


lst1.insert( 3, 4)
lst1.insert( 2, 3)
print (lst1[-5])

(a) 2 (b) 3 (c) 4 (d) 20


23 Evaluate the following expression and identify the correct
answer.
16 - (4 + 2) * 5 + 2**3 * 4

(a) 54 (b) 46 (c) 18 (d) 32


24 What is the correct declaration of a tuple P to obtain the
following output?

p = …………………
print(p*2)

Output: (240, 240)

(a) (240) (b) “240” (c) (240,) (d) (120)


25 Identify the output of the following Python statements.

L1= [[‘Red’,’Green’],[‘Blue’,‘Yellow’,‘Orange’], [‘Black’,‘White’]]


7
print(L1[2][0][3])

(a) ‘c’ (b) ‘a’ (c) Black (d) White


26 The Primary key is selected from the set of _______.

(a) Composite Key (b) Determinants


(c) Candidates Key (d) Foreign Key
Q. No. 27 to 30 are ASSERTION (A) and REASONING (R) based
questions. Mark the correct choice as:
a. Both A and R are true and R is the correct explanation for A.
b. Both A and R are true and R is not the correct explanation for
A.
c. A is true but R is false.
d. A is false but R is true.
27 Assertion (A): A foreign key in the relational data model is a
set of attributes in one relation that references the primary key
of another relation.
Reason (R): Foreign keys are used to establish relationships
between tables . a
28 Assertion (A): While inserting records in EMP table, value of
DateOfBirth field must be enclosed within quotes ‘ ‘.
Reasoning(R): Date is represented as char / varchar always. c
29 Assertion (A): The default argument values in Python functions
can be mutable types like lists and dictionaries.
Reason (R): Mutable default arguments retain their state across
function calls, which can lead to unexpected behavior. a

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

(a) – 9 (b) 153 (c) 70 (d) 152


32 What will be the output of the following Python code?
def FinalMarks(T1, T2):
return T1+T2
T1=150
T2=160
print(”Total marks scored are”,FinalMarks())

(a) 310 (b) 0 (c) None (d) Error


33 What will be the output of the following code?

number1 = 100
def funct1(x):
global number1
number1 = 200
number1 = number1**x
print(number1)
9
funct1(2)
print(number1)

(a) 200 (b) 100 (c) 100 (d) 200


40000 10000 40000 10000
34 What will be the output of the following code?

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='#')

(a) 9#2#8#16#81# (b) 27#4#16#64#729#


(c) 9#8#16#64#729# (d) 27#8#16#81#729#
36 What possible outputs are expected to be displayed on the
screen at the time of execution of the program from the
following code?

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)

(a) 10@59#59 (b) 59@10#59


(c) 59@59#10 (d) 10@10#10
38 Lakshman wants to remove the primary key assigned to
‘bookid’ from the book table. Help him in writing suitable code.

a)DROP PRIMARY KEY FROM BOOK;


b)ALTER TABLE BOOK MODIFY BOOKID DROP PRIMARY KEY;
c)ALTER TABLE BOOK DROP PRIMARY KEY;
d)ALTER TABLE BOOK DROP PRIMARY KEY(BOOKID);
39 Which of the following is not a valid operator in SQL?

a)in b)like c)is not null d)==


40 What will be the output of the following code snippet?
Tup1=(9,3,5,[1,2,3],8)
Tup1[3][1]=10
print(Tup1)

(a) Error (b) (9, 3, 5, [1, 10, 3], 8)


(c) (9, 3, 5, [1, 10, 2, 3], 8) (d) (3, 3, 3, [1, 10, 3], 10)
41 Which command will delete the database from the system?

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.

a)Not Null b)Default c)Null d)Non-Empty


50 How many times will the following loop execute and give the
output?
z=7
sum=0;
while z<=12:
sum=sum+z
z=z+2
print(z)

14
(a) 3 times, output-13
(b) 3 times,output-12
(c) 4 times,output-11
(d) 4 times,output-12

15

You might also like