Home
MCQS
Python MCQ Quiz Hub
MCQ Introduction to Python Section 3
Choose a topic to test your knowledge and improve your Python skills
1. >>> bool(0) evaluates to __
False
True
Error
None of the above
2. ____ operators are used to check if a value is a member of the given sequence or not.
Logical
Identity
Membership
Relational
3. Write the output of following code: >>> n1 = 5 >>> n2 = n1 >>> n2 is n1
True
False
Error
5
4. Which operators can be used to determine whether two variables are referring to the same object or not.
Relational
Logical
Identity
Membership
5. Which of the following is valid membership operator?
in
not in
Both of the above
None of the above
6. _________ is defined as a combination of constants, variables, and operators.
Statement
Expression
Operation
None of the above
7. Which of the following is invalid expression?
250
32 / 4 + 7
“Global” + “Citizen”
in
8. Binary operators are operators with ________ operands
1
2
3
4
9. >>> 14 + 2 ** 2 evaluates to
256
18
28
32
10. >>> 15.0 / 4 + (8 + 3.0) evaluates to ________________
14.75
14
15
None of the above
11. >>> 15.0 / 4 + (8 + 3.0) evaluates to ________________
14.75
14
15
None of the above
12. >>> 15.0 / 4 + (8 + 3.0) evaluates to ________________
14.75
14
15
None of the above
13. In Python, we have ____________________ function for taking input from the user.
input( )
accept( )
c. enter( )
insert( )
14. The user may enter a number or a string but the input() function treats them as _
integer only
list
strings only
tuple
15. Write the output of the following : >>> age = input("Enter your age: ") >>> type(age)
<class ‘int’>
<class ‘str’>
<class ‘list’>
None of the above
16. Write the output of the following : >>> age = input("Enter your age: ") Enter your age: 3 >>> age * 3
9
333
33
Error
17. What type of error is returned by following statement? >>> age = input("Enter your age: ") Enter your age: 3 >>> age + 3
SyntaxError
IndexError
ValueError
TypeError
18. Python uses _________________ function to output data to standard output device.
print( )
display( )
output( )
None of the above
19. print(“I” + “am” + “in” + “school”) display ___
I am in school
I Am In School
Iaminschool
iaminschool
20. print(“I” , “am” , “in” , “school”) display __
I am in school
I Am In School
Iaminschool
iaminschool
21. Which of the following is parameter of print( ) function?
sep
end
Both of the above
None of the above
22. int(123.45) is an example of _
explicit conversion
implicit conversion
quick conversion
None of the above
23. ________ happens when data type conversion is done automatically by Python.
Implicit conversion
Explicit conversion
Both of the above
None of the above
24. Write the output of the following : num1 = 100 num2 = 2.0 sum1 = num1 + num2 print(sum1)
102
102.0
Error
None of the above
25. In given code _____________ conversion takes place. num1 = 100 num2 = 2.0 sum1 = num1 + num2 print(sum1)
implicit
explicit
hybrid
None of the above
26. Which of the following function convert the data type of variable ‘x’ from float to integer?
float( )
int( )
str( )
num( )
27. Which of the following is explicit type conversion function in Python?
int( )
str( )
float( )
All the above
28. Fill in the blank in given code : print("The total in Rs." + __________(70))
int
float
str
bool
29. In the given code, an integer value stored in variable num1 is added to a float value stored in variable num2, and the result is stored in variable sum1. This is an example of _____ sum1 = num1 + num2
implicit conversion
explicit conversion
data conversion
value conversion
30. The process of removing errors from programs is called _________
Programming
Documentation
Debugging
None of the above
31. Which of the following error may encounter in program of python?
Syntax error
Logical error
Runtime error
All the above
32. Ravi is writing a program of printing “Hello World” but he forgot to close the bracket of print( ) function (as shown below). What type of error is this? print("Hello World"
Syntax error
Logical error
Runtime error
None of the above
33. ___ produces an undesired output but without termination of the program. a. Syntax error b. Logical error c.
Syntax error
Logical error
Runtime error
None of the above
34. Aman wants to find the average of two numbers 10 and 12 and he write the code as 10 + 12/2, it would run successfully but the output is not correct. What type of error is done by Aman?
Syntax error
Logical error
Runtime error
None of the above
35. ___ error causes abnormal termination of program while it is executing.
Syntax error
Logical error
Runtime error
None of the above
36. Which of the following statement return run time error ?
Divide any number by zero
Adding any number to zero
Subtracting any number from zero
Multiply any number with zero
37. Errors in program is also called ____
virus
bug
beetle
val
38. IDLE stands for __________
Integrated Development LEarning
Integrated Development Learning Environment
Intelligent Development Learning Environment
None of the above
39. IDLE stands for __________
Integrated Development LEarning
Integrated Development Learning Environment
Intelligent Development Learning Environment
None of the above
40. Which of the following statement is correct to initialize multiple variables?
a = b = c = 85
a = b and c = 85
a = 85 , c = 85 , b =85
All the above
41. Which of the following statement is correct syntactically ?
print(“Hello” , sep == ‘@’ , end = ‘ ‘)
print(“Hello” , sep = ‘@’ , end = ‘ ‘)
Print(“Hello” , sep = ‘@’ , end = ‘ ‘)
print(“Hello” , sep = ‘@’ , end = ‘ ‘
42. Write the output of the following : print(true and False)
True
False
Error
None of the above
43. Write the output of the following : print(3 and (5 or 0))
3
5
True
False
44. Write the output of the following : print(True and (False or True))
True
False
Error
None of the above
45. Write the output of the following code : print((15 // 2 ** 2) * 'A')
3
Error
AAA’
4
46. Write the output of the following : 22 + (7 -2 // 9 ** 2) a. 22 b. 7 c. 29 d. 0
22
7
29
0
47. Which of the following is mutable data type?
string
Tuple
List
All the above
Submit