46- Which method is used to remove a specific element from a list?
Anonymous Quiz
20%
a) pop()
61%
b) remove()
7%
c) discard()
13%
d) delete()
48- What will be the result of print("Hello"[1:4])?
Anonymous Quiz
7%
a) Hel
65%
b) ell
4%
c) llo
24%
d) ello
49- Which of the following is used to read a file in Python?
Anonymous Quiz
20%
a) open()
45%
b) read()
24%
c) file()
11%
d) input()
50- How can you make a string in Python all uppercase?
Anonymous Quiz
68%
a) upper()
13%
b) capitalize()
4%
c) toupper()
16%
d) uppercase()
👍1
51- What is the output of print(5 < 10 and 10 < 20)?
Anonymous Quiz
84%
a) True
13%
b) False
0%
c) 5
4%
d) None
53- Which method is used to return a string with the first letter capitalized?
Anonymous Quiz
70%
a) capitalize()
11%
b) upper()
0%
c) noscript()
20%
d) first_upper()
56- In Python, single-line comments are created using the # symbol.
Anonymous Quiz
88%
a) True
13%
b) False
58- The for loop in Python can be used to iterate over strings.
Anonymous Quiz
89%
a) True
11%
b) False
60- The in operator is used to check if a value exists within a list.
Anonymous Quiz
82%
a) True
18%
b) False
62- A method in a class cannot be called without creating an instance of the class.
Anonymous Quiz
61%
a) True
39%
b) False
63- The __init__ method in Python is called the constructor of a class.
Anonymous Quiz
87%
a) True
13%
b) False
64- In Python OOP, encapsulation means hiding the class data by making attributes private.
Anonymous Quiz
87%
a) True
13%
b) False
65- Inheritance allows a new class to extend the properties and methods of an existing class.
Anonymous Quiz
87%
a) True
13%
b) False
66- What does the __init__() method in a Python class do?
Anonymous Quiz
6%
a) Deletes an object
91%
b) Initializes the class attributes
4%
c) Prints a message
0%
d) Compares two objects
67- Which of the following statements is true about class attributes?
Anonymous Quiz
25%
a) They belong to a specific object instance
64%
b) They are shared among all instances of a class
7%
c) They cannot be changed
4%
d) They are defined inside methods only
👎6