Q1. In Python, which of the following is the super class of all created classes?
- Super class
- Object class
- Integer class
- Base class
Q2. What will be the output of following code:
1 2 3 4 |
x = [1, 2, 3] y = x y.pop() print(x, y) |
- [1, 2] [1, 2, 3]
- [1, 2, 3] [1, 2]
- [1, 2, 3] [1, 2, 3]
- [1, 2] [1, 2]
Q3. What will be the output of following code:
1 2 3 4 5 |
x = {1:'a', 2:'b', 3:'c'} del x[1] x[1] = 5 del x[2] print(len(x)) |
- 2
- 1
- 4
- 3
Q4. What will be the output of following code:
1 2 3 4 5 6 |
def func(**kwargs): print(type(kwargs), end=" ") for i in kwargs: print(i, end=" ") func(x=1, y=2) |
x y 1 2 x y 1 2
Q5. In Python, which of the following is a numeric data type?
- int
- float
- complex
- All of the above.
Q6. What will be the output of following code:
1 2 3 |
x1 = {1, 2, 3} x2 = x1.add(4) print(x1, x2) |
- {1, 2, 3} {1, 2, 3, 4}
- {1, 2, 3, 4} None
- {1, 2, 3, 4} {1, 2, 3, 4}
- Error
Q7. What will be the output of following code”
1 2 3 4 5 |
for i in range (5): with open("a.txt", "r") as file: if i > 2: break print(file.closed, i) |
- False 5
- True 5
- False 3
- True 3
Q8. What is the difference between a global variable and a local variable?
- Global variable can be used inside a function only while local variable can be used both inside and outside the function.
- Local variable can be used inside a function only while global variable can be used both inside and outside the function.
- Both are same.
- Both are different name for same variables.