PacketPrep Exam Paper
Python
1. ____ variable is the variable that is stored inside the function.
A. Local
B. Global
2. Can you use a local variable outside the function?
A. Yes
B. No
C. Only in the special case
3. ____ variables are the variables that can be used in the entire program.
A. Global
B. Local
4. Which keyword is used to assign a local variable?
A. Global
B. Local
C. No, it has no keyword
5. Which keyword is used to assign a global variable?
A. global
B. local
C. No, it has no keyword
6. Can you delete the variable during a program?
A. Yes
B. No
7. By default the numerical data in series is starting from
A. 2
B. 1 C. 0 D. 3
PacketPrep Exam Paper
Python
8.Which of the following is/are advantages of using object oriented
programming
1.Code reusability
2.Can create more than one instance of a class without interference
3.Platform independent
4.All options are correct
9. Which of the following is correct with respect to the OOP concept in Python?
A. Objects are real-world entities while classes are not real.
B. Classes are real-world entities while objects are not real.
C. Both objects and classes are real-world entities.
D. Both objects and classes are not real.
10. How many objects and reference variables are there for the given Python code?
class A:
print(“Inside class”)
A()
A()
obj=A()
A.2and1
B.3and3
C.3and1
D. 3 and 2
PacketPrep Exam Paper
Python
11. Which of the following is False with respect to Python code?
A. “std” is the reference variable for object Student(1,20)
B. id and age are called the parameters.
C. Every class must have a constructor.
D. None of the above
12. What will be the output of below Python code?
A. 1 2 B. 2 1 c. 3 2 d. 4 2
PacketPrep Exam Paper
Python
13. What will be the output of below Python code?
A.100 102 B.102 100 C.101 102
14. Which of the following is correct?
A. id(a1) and id(a2) will have the same.
B> id(a1) and id(a2) will have different
C. Two objects with same value of the attribute cannot be created.
D. None of the above
15. Which of the following is correct?
PacketPrep Exam Paper
Python
A. 5
B. 6
C. 0
D. Error
II. Answer Following All Questions
1.Write a program to print the given pattern
2.Write a program to print the prime numbers between 1 to 100.
3.Explain the all types of variables with example programs
PacketPrep Exam Paper
Python
4.Explain the all types of methods with example programs
5.Explain about self and Constructor
6.Explain regarding the polymorphisms, how to achieve it Given
examples
7.Write a program to find the reference variables in the program.