Python is known as
Anonymous Quiz
23%
Compiled language
55%
Interpreted language
9%
Machine language
14%
Assembly language
🔥1
Which version of python removed the print statement?
Anonymous Quiz
17%
Python 1.x
28%
Python 2.x
33%
Python 3.x
22%
Python 4.x
🔥1
my_list = [1, 2, 3, 4, 5]
result = my_list[-3:-1] print(result)
result = my_list[-3:-1] print(result)
Anonymous Quiz
35%
A) [3, 4]
24%
B) [2, 3]
35%
C) [3, 4, 5]
6%
D) [1, 2, 3, 4]
🔥1
In Python which of the following is the proper syntax to check if a particular element is present in a list?
Anonymous Quiz
20%
if ele in list
0%
if not ele not list
50%
Both Aand B
30%
None of the above
🔥1
How do you access the value associated with a key 'k' in a dictionary 'd'?
Anonymous Quiz
0%
d['k']
38%
d.get('k')
50%
Both A and B
13%
None of the above
🔥1
In python, What happens if you try to access a non-existent key 'k' in a dictionary 'd' using d[k]?
Anonymous Quiz
0%
Returns None
13%
Returns an empty string
88%
Raises a KeyError
0%
Creates a new key 'k' with value None
🔥1
In Python 3.7 and later, how are elements in a dictionary ordered?
Anonymous Quiz
63%
By the order they were added
0%
In ascending order of keys
38%
In descending order of keys
0%
Randomly
🔥1
What is a function in Python?
Anonymous Quiz
29%
A variable
29%
A module
43%
A block of code
0%
An operator
🔥1
In Python, what is a module?
Anonymous Quiz
14%
A data type
29%
A built-in function
29%
A file with definitions
29%
A code block
🔥1
How do you import a module in Python?
Anonymous Quiz
60%
using the import keyword
20%
using the include keyword
20%
using the require keyword
0%
using the module keyword
🔥1
What is the difference between arguments and parameters in Python functions?
Anonymous Quiz
0%
No difference
100%
Parameters define, arguments call
0%
Arguments define, parameters call
0%
Based on data type
🔥1
In Python, what is the purpose of the try statement?
Anonymous Quiz
60%
To test a block of code for errors
40%
To execute code regardless of errors
0%
To generate an error
0%
To declare variables
🔥1
Which exception is raised by Python when a file you try to open does not exist?
Anonymous Quiz
80%
FileNotFoundError
20%
IOError
0%
OSError
0%
ValueError
🔥1
When is the else clause in a try-except block executed?
Anonymous Quiz
0%
Always after the try block
75%
When no exceptions are raised
25%
When an exception is handled
0%
It is never executed
🔥1
What is a list comprehension in Python?
Anonymous Quiz
25%
A concise way to create lists
0%
A method to iterate through lists
75%
A type of Python comprehension
0%
A special function for lists
🔥1
What is the key difference between list comprehensions and generator expressions?
Anonymous Quiz
25%
The syntax used
0%
The type of brackets used
75%
List comprehensions produce lists, while generator expressions produce generators
0%
Execution speed
🔥1
What will this list comprehension produce:
[x**2 for x in range(5)]
[x**2 for x in range(5)]
Anonymous Quiz
0%
[0, 1, 2, 3, 4]
17%
[1, 4, 9, 16, 25]
83%
[0, 1, 4, 9, 16]
0%
[1, 2, 3, 4, 5]
🔥1