Which one of the following has the highest precedence in the expression?
Anonymous Quiz
22%
Exponential
7%
Addition
62%
Parentheses
8%
Multiplication
1- Which of the following is NOT a feature of OOP in Python?
Anonymous Quiz
5%
A) Inheritance
5%
B) Polymorphism
87%
C) Procedural Programming
3%
D) Encapsulation
2- Which of the following defines encapsulation?
Anonymous Quiz
29%
A) Grouping data and functions that operate on the data in a single unit
18%
B) Allowing a subclass to inherit properties of a superclass
4%
C) Allowing multiple methods to have the same name
49%
D) Restricting access to some of an object’s components
3- In Python, how is inheritance implemented?
Anonymous Quiz
1%
A) Using the self keyword
11%
B) Using the __init__ method
4%
C) Using the colon :
83%
D) By specifying the parent class in parentheses after the child class name
4- What does polymorphism mean in Python?
Anonymous Quiz
4%
A) One class can inherit from multiple classes
84%
B) The ability to define methods that have the same name but act differently
0%
C) The ability to hide data within a class
12%
D) All of the above
❤1
5- Which method is called when an object is created?
Anonymous Quiz
83%
A) __init__
7%
B) __new__
8%
C) __create__
1%
D) __build__
6- What is the purpose of an abstract class in Python?
Anonymous Quiz
78%
a) To define methods that must be implemented by any subclass
12%
b) To prevent the creation of subclasses
6%
c) To provide a method for object deletion
3%
d) To store static data
7- What does the super() function refer to in Python?
Anonymous Quiz
76%
A) The parent class
7%
B) The current class
15%
C) The current instance
1%
D) A sibling class
8- Which of the following is NOT an example of polymorphism in Python?
Anonymous Quiz
13%
A) Method overriding
1%
B) Method overloading
21%
C) Operator overloading
64%
D) Creating multiple instances of a class
9- What is the purpose of the super() function in Python?
Anonymous Quiz
19%
A) To call the parent class’s constructor
40%
B) To access methods and properties from the parent class
1%
C) To create a new instance of a class
40%
D) Both A and B
12- Python supports both procedural and object-oriented programming paradigms.
Anonymous Quiz
87%
A) True
13%
B) False
👎1
13- The import statement in Python is used to include external modules or libraries in a noscript.
Anonymous Quiz
81%
A) True
19%
B) False
❤1
14- Which of the following is a valid way to define a Python function?
Anonymous Quiz
12%
a) def function_name[]:
9%
b) function function_name():
77%
c) def function_name():
2%
d) function_name def():
15- How do you create a new list with the values [1, 2, 3]?
Anonymous Quiz
84%
a) list = [1, 2, 3]
12%
b) list = (1, 2, 3)
4%
c) list = {1, 2, 3}
0%
d) list = 1, 2, 3
👏1
19- Which operator is used for floor division in Python?
Anonymous Quiz
10%
a) /
85%
b) //
1%
c) %
3%
d) ^
20- Which function is used to get the data type of an object?
Anonymous Quiz
79%
a) type()
6%
b) id()
6%
c) data()
9%
d) class()
22- How do you create a dictionary in Python?
Anonymous Quiz
8%
a) dict = [key1: value1, key2: value2]
82%
b) dict = {key1: value1, key2: value2}
8%
c) dict = (key1: value1, key2: value2)
3%
d) dict = <key1: value1, key2: value2>