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>
23- Which method removes the last item from a list?
Anonymous Quiz
73%
a) pop()
18%
b) remove()
8%
c) delete()
2%
d) discard()
24- What does the split() method do?
Anonymous Quiz
5%
a) Joins a list into a string
73%
b) Splits a string into a list
11%
c) Converts string to uppercase
11%
d) Replaces parts of a string
25- Which operator is used to check if two values are equal?
Anonymous Quiz
0%
a) =
91%
b) ==
3%
c) !=
5%
d) ===
26- What is the output of print(bool([]))?
Anonymous Quiz
12%
a) True
72%
b) False
2%
c) 0
14%
d) None
27- Which of the following is not a valid Python variable name?
Anonymous Quiz
5%
a) variable_name
5%
b) VariableName
79%
c) variable-name
10%
d) _variableName
28- What is the default return value of a function that does not explicitly return a value?
Anonymous Quiz
14%
a) 0
76%
b) None
5%
c) '' (empty string)
5%
d) False
29- Which keyword is used to define a class in Python?
Anonymous Quiz
73%
a) class
20%
b) def
3%
c) new
3%
d) create
30- How do you check if a key exists in a dictionary?
Anonymous Quiz
62%
a) key in dict
9%
b) dict.has_key(key)
5%
c) dict.contains(key)
24%
d) key.exists(dict)
31- The continue statement skips the current iteration of a loop and proceeds to the next iteration.
Anonymous Quiz
87%
a) True
13%
b) False
32- Python’s if statements require parentheses around the condition.
Anonymous Quiz
32%
a) True
68%
b) False
33- What is the result of creating two objects of the same class, but modifying one object's attributes?
Anonymous Quiz
23%
a) Both objects will have the same values for all attributes
46%
b) Each object will have independent attributes
18%
c) The class attributes will be shared by both objects
14%
d) One object will inherit from the other
34- Which statement is true about inheritance in Python?
Anonymous Quiz
75%
a) A child class can override methods in the parent class
9%
b) Inheritance prevents method overriding
5%
c) Inheritance is not supported in Python
11%
d) A child class cannot call the parent class methods