0% found this document useful (0 votes)
11 views9 pages

XII Revision Tour MCQs

The document is a revision guide for Computer Science XII, containing a series of programming questions and multiple-choice answers related to Python. It covers topics such as string manipulation, list indexing, tuples, dictionaries, and built-in functions. Each question is followed by four answer options, with the document prepared by Namita Ranjan, PGT CS, KV AFS Bareilly.

Uploaded by

DPS SOUTH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

XII Revision Tour MCQs

The document is a revision guide for Computer Science XII, containing a series of programming questions and multiple-choice answers related to Python. It covers topics such as string manipulation, list indexing, tuples, dictionaries, and built-in functions. Each question is followed by four answer options, with the document prepared by Namita Ranjan, PGT CS, KV AFS Bareilly.

Uploaded by

DPS SOUTH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

COMPUTER SCIENCE-XII

REVISION TOUR

1. What is the output of the following?


x = ['ab', 'cd']
for i in x:
i.upper()
print(x)

a) [‘ab’, ‘cd’].
b) [‘AB’, ‘CD’].
c) [None, None].
d) none of the mentioned

2. What is the output of the following?

x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)

a) [‘AB’, ‘CD’].
b) [‘ab’, ‘cd’, ‘AB’, ‘CD’].
c) [‘ab’, ‘cd’].
d) none of the mentioned

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 1


3. What is the output of the following?
i=1
while True:
if i%3 == 0:
break
print(i)

i+=1

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

4. What is the output of the following?

i=1
while True:
if i%2 == 0:
break
print(i)
i += 2

a) 1
b) 1 2

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 2


c) 1 2 3 4 5 6 ...
d) 1 3 5 7 9 11 ...

5. What is the output of the following?

True = False
while True:
print(True)
break

a) True
b) False
c) None
d) none of the mentioned

6. What is the output when following statement is executed?


>>>"a"+"bc"

a) a
b) bc
c) bca
d) abc

7. What is the output when following statement is executed?


>>>"abcd"[2:]

a) a

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 3


b) ab
c) cd
d) dc

8. What is the output of the following code:

>>> str1='hello'
>>> str2=','
>>> str3='world'
>>> str1[-1:]

a) olleh
b) hello
c) h
d) o

9. What is the output of "hello"+str(1+2+3)

a) hello123
b) hello6
c) hello
d) Error

10. Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ?

a) Error
b) None

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 4


c) 25
d) 2

11. Suppose list1 is [2, 33, 222, 14, 25],What is list1[:-1] ?

a) [2, 33, 222, 14].


b) Error
c) 25
d) [25, 14, 222, 33, 2].

12. Suppose list1 is [1, 3, 2], What is list1 * 2 ?

a) [2, 6, 4].
b) [1, 3, 2, 1, 3].
c) [1, 3, 2, 1, 3, 2] .
D) [1, 3, 2, 3, 2, 1].

13. Which of the following is a Python tuple?


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

14. Suppose t = (1, 2, 4, 3), which of the following is incorrect?

a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

15. What will be the output?


PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 5
>>>t=(1,2,4,3)
>>>t[1:3]

a) (1, 2)
b) (1, 2, 4)
c) (2, 4)
d) (2, 4, 3)

16. What will be the output?


>>>t=(1,2,4,3)
>>>t[1:-1]

a) (1, 2)
b) (1, 2, 4)
c) (2, 4)
d) (2, 4, 3)

17. Which of the following statements create a dictionary?

a) d = {}
b) d = {“john”:40, “peter”:45}
c) d = {40:”john”, 45:”peter”}
d) All of the mentioned

18. What will be the output?


d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 == d2

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 6


a) True
b) False
c) None
d) Error

19. What will be the output?


d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 > d2

a) True
b) False
c) Error
d) None

20. Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in


dictionary which command do we use?

a) d.size()
b) len(d)
c) size(d)
d) d.len()

21. What is the output of the expression:


round(4.576)
a) 4.5
b) 5
c) 4
d) 4.6

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 7


22. What is the output of the function shown below?
import math
abs(math.sqrt(25))

a) Error
b) -5
c) 5
d) 5.0

23. What is the output of the functions shown below?


min(max(False,-3,-4), 2,7)
a) 2
b) False
c) -3
d) -4

24. What are the outcomes of the following functions?

chr(‘97’)
chr(97)

a) a
Error
b) ‘a’
a
c) Error
a
d) Error

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 8


Error

25. Which of the following functions will not result in an error when no arguments
are passed to it?

a) min()
b) divmod()
c) all()
d) float()

PREPARED BY NAMITA RANJAN,PGT CS,KV AFS BAREILLY 9

You might also like