0% found this document useful (0 votes)
10 views3 pages

PYTHON

The document contains a series of multiple-choice questions related to Python programming, covering topics such as constructors, data types, list operations, and mathematical functions. Each question provides several answer options, testing knowledge on Python syntax and behavior. The questions range from basic to intermediate concepts in Python programming.
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)
10 views3 pages

PYTHON

The document contains a series of multiple-choice questions related to Python programming, covering topics such as constructors, data types, list operations, and mathematical functions. Each question provides several answer options, testing knowledge on Python syntax and behavior. The questions range from basic to intermediate concepts in Python programming.
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/ 3

G.

TEC COMPUTER EDUCATION


ISO 9001-2008 CERTIFIED
PYTHON

1. Syntax of constructor in Python?


a) def __init__() b) def _init_() c) _init_()

2. The format function, when applied on a string returns:


a) list b) bool
c) int d) str
3. How to find the last element of list in Python? Assume `bikes` is the name of list.
a) bikes[0] b) bikes[-1] c) bikes[lpos]

4. What is correct syntax to copy one list into another?


a) listA = listB[] b) listA = listB[:] c) listA = listB[]()

5. What is answer of this expression, 22 % 3 is?


a) 7 b) 1
c) 0 d) 5
6. If a='GTEC', b='EDUCATION' then which of the following operation would show
'GTECEDUCATION' as output?
a) a+b b) a+""+b c) All of the above

7. Which of these in not a core datatype?


a) Lists b) Dictionary
c) Tuples d) Class
8. 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
9. If a='gtec', b='education' then what is the output of:
c = a-b
printc)
a) gtec-education
b) gteceducation
c) TypeError: unsupported operand
10. What is the return value of trunc()?
a) Int b) bool
c) float d) None
11. Which of these in not a core datatype
a) Lists b) Dictionary
c) Tuples d) Class
12. Given a function that does not return any value, what value is thrown by itby default
when
executed in shell
a) int b) bool
c) void d) None
13. What dataype is the object below ? L = [1, 23, 'hello',1]
a) List b) dictionary
c) array d) tuple
14. What is the default base used when math.log(x) is found?
a) e
b) 10
c) 2
d) none of the mentioned
15. The function random.randint(4) can return only which one of the following values?
a) 4
b) 3.4
c) error
d) none of the mentioned
16. To read two characters from a file object infile, we use?
a) infile.read(2)
b) infile.read()
c) infile.readline()
d) infile.readlines()
17. 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))

18. What will be the output?


t=(1,2,4,3)
t[1:3]
a) (1, 2)
b) (1, 2, 4)
c) (2, 4)
d) (2, 4, 3)
19. Which is the correct operator for power(x^y)?
a) X^y
b) X**y
c) X^^y
d) None of the mentioned
20. Which one of these is floor division?
a) /
b) //
c) %
d) None of the mentioned

You might also like