Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views8 pages

Top 50 MCQ Python Programming

Uploaded by

SANGEETHA RKN
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)
5 views8 pages

Top 50 MCQ Python Programming

Uploaded by

SANGEETHA RKN
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/ 8

GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC

PYTHON MCQ SERIES Data Mining Hub

1. Which of the following character is used to give single-line comments in Python?


a) //
b) #
c) !
d) /*
2. Which type of Programming does Python support?
a) object-oriented programming
b) structured programming
c) functional programming
d) all of the mentioned
3. All keywords in Python are in
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

4. Which of the following is the correct extension of the Python file?


a) .python
b) .pl
c) .py
d) .p

5. Which of the following is true for variable names in Python?


a) underscore and ampersand are the only two special characters allowed
b) unlimited length
c) all private members must have leading and trailing underscores
d) none of the mentioned
6. What will be the output of the following Python code-
print(2**(3**2))
print((2**3)**2))
print(2**3**2)
a) 512
64
512
b) 512
512
512
c)64
512
64
d)64
64
64

1 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course
GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC
PYTHON MCQ SERIES Data Mining Hub
7. Which of the following is the truncation division operator in Python?
a) |
b) //
c) /
d) %
8. Which of the following is the use of id() function in python?
a) Every object doesn’t have a unique id
b) Id returns the identity of the object
c) All of the mentioned
d) None of the mentioned
9. What will be the value of the following Python expression?4 + 3
%5
a) 7
b) 2
c) 4
d) 1
10. What will be the output of the following Python code snippet ifx=1
x=x<<2
print(x)
a) 4
b) 2
c) 1
d) 8
11. Which one of the following is not a keyword in Python language?
a) pass
b) eval
c) assert
d) nonlocal
12. What will be the output of the following Python code snippet ifx=4
x=x>>2
print(x)
a) 4
b) 2
c) 1
d) 8
13. What will be the output of the following Python statement? print("a"+"bc“)
a) bc
b) abc
c) a
d) bca

2 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course
GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC
PYTHON MCQ SERIES Data Mining Hub
14. Which of the following is not a core data type in Python programming?
a. Tuples
b. Lists
c. Class
d. Dictionary
15. What is the maximum possible length of an identifier in Python?
a. 79 characters
b. 31 characters
c. 63 characters
d. none of the mentioned
16. Which of the following is an invalid identifier?
a. CS_class_XII
b)csclass12
c)_csclass12 d)12CS
17. The tiny inidividual unit in python program is known as
a)Expression
b)Statement
c)Token
d)Comment
18. Which of the following is correct statement to computer square of variable x in python?
a. x * 2
b. x power 2
c) x ** 2
d) x // 2
19. Which of the is a correct statement?a) xyz
= 10 100 1000
b) x y z = 10 100 1000
c) x, y, z = 10, 100, 1000
d) x y z= 10, 100, 1000
20. By default the input() function returns
a. Integer
b. Float
c. Boolean
d. String

For Explanation of MCQ Series Subscribe to My Channel: https://youtube.com/@datamininghub

3 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course
GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC
PYTHON MCQ SERIES Data Mining Hub
21. Which of the following cannot be a variable?

a) __init__ b) in c) it d) on
22. Which keyword is used for function in Python language?
a) Function b) def c) Fun d) Define
23. What will be the output of the following Python code?
i=1
while True:
if i%3 == 0:
break
print(i)
i+=1
a) 1 2 3
b) error
c) 1 2
d) none of the mentioned
24. What is the order of precedence in python?
a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Division, Subtraction, Addition
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
25. What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
a) -4 b) -3 c) 2 d) False
26. What arithmetic operators cannot be used with strings in Python?
a) * b) – c) + d) All of the mentioned
27. What will be the output of the following Python code?
list1 = [1, 3]
list2 = list1
list1[0] = 4
print(list2)
a) [1, 4]
b) [1, 3, 4]
c) [4, 3]
d) [1, 3]
28. Which of the following Python statements will result in the output: 6?
A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
a) A[2][1]
b) A[1][2]
c) A[3][2]
d) A[2][3]

4 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course
GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC
PYTHON MCQ SERIES Data Mining Hub
29. What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
print(i)
a) error
b) 1 2 3 4
c) a b c d
d) 0 1 2 3
30. Which of the following is a Python tuple?
a) {1, 2, 3}
b) {}
c) [1, 2, 3]
d) (1, 2, 3)
31. Write the output of following code:
print(7+2//1**2>5+2**2//3)
a) True b) False c) Error d) Empty
32. Write the output of following code:
a=“india”
a*=3
print(a)
a) india
b) india3
c) indiaindiaindia
d) 3india
33. Evaluate the following expression in python:
6*3+4**2//5-8
a) 10 b) 3 c) 23 d)13
34. Output of the following python code:
print(10>5 and 7>12 or not 18>3)
a) False b) True c) Error d) Empty
35. Output of the following python code:
a=4
b=9
c=3
x=str(a*b)*c
print(x)

a) 636363
b) 493
c) 36363636
d) 363636

5 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course
GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC
PYTHON MCQ SERIES Data Mining Hub
36. What will be the Output of the following python code:
str=“programming”
print(str[6:-3])
a) mi b) mm c) am d) m
37. What will be the Output of the following python code:
str=“programming”
print(str[6:-4])
a) mi b) mm c) am d) m

38. What will be the Output of the following python code:


str=“programming”
print(str[6:-5])
a) mi b) mm c) m d) No Output
39. What will be the Output of the following python code:
str=“hello”
print(str[ :2])
a) he b) lo c) olleh d) hello
40. Which of the following is incorrect:
str=“welcome”

a) print(str[2])
b) str[2]=“p”
c) print(len(str))
d) All are correct

41. Given a Tuple tup1= (10, 20, 30, 40, 50, 60, 70, 80, 90).

What will be the output of print (tup1 [3:7:2])


a) (40,50,60,70,80)
b) (40,50,60,70)
c) [40,60]
d) (40,60)
42. Which one of the following is the correct way of calling a function?
a) function_name()
b) call function_name()
c) ret function_name()
d) function function_name()
43. Which of the following is true regarding lists in Python?
a) Lists are immutable.
b) Size of the lists must be specified before its initialization.
c) Elements of lists are stored in contagious memory location.
d) size(list1) command is used to find the size of lists.

6 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course
GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC
PYTHON MCQ SERIES Data Mining Hub

44. Which of these about a dictionary is false?


a) The values of a dictionary can be accessed using keys.
b) The keys of a dictionary can be accessed using values.
c) Dictionaries are not ordered.
d) Dictionaries are mutable.

45. Write the output of following python code:

x=2
x=5
x=x+x
print(x)
a) 7 b) 4 c) 10 d) Error

46. Write the output of following python code:

x=8
def pc(x):
print(x)
pc(9)
a) 8 b) 9 c) 10 d) Error

47. Which method is used to find memory location of a variable ?

a) id( )
b) add( )
c) type( )
d) max( )
48. ________escape sequence is used for horizontal tab.
a) \n
b) \t
c) \T
d) None
49. Write the output of following Python code:

>>> a=9
>>> x=str(a)
>>> b=10
>>> y=str(b)
>>> print(x+y)
a) 19 b) 9 c) 910 d) error

7 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course
GATE | UGC-NET | HPSC | KVS | DSSSB | TGT COMPUTER SCIENCE | PGT COMPUTER SCIENCE | NIELIT | NIC
PYTHON MCQ SERIES Data Mining Hub
50. Write the output of following code:

x,y=‘5’,2
z=x+y
print(z)
a) 52
b) 7
c) Error
d) “52”

For Explanation of MCQ Series Subscribe to My Channel:


https://youtube.com/@datamininghub

8 SUBSCRIBE https://youtube.com/@datamininghub
Data Mining Hub Class 11-12 Computer Science | NIELIT O Level Course

You might also like