ExamVeda
Login
Home
31
What will be the output of the following Python code?
>>>str="hello"
>>>str[:2]
>>>
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
32
What does ~~~~~~5 evaluate to?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
33
What is the result of abs(3 + 4j) ?
Discuss
Answer & Solution
Answer: Option C
Solution:
In Python, the abs() function returns the magnitude (modulus) of a complex number.

A complex number is written in the form a + bj, where a is the real part and b is the imaginary part.

The magnitude of a complex number is calculated using the formula √(a² + b²).

For the complex number 3 + 4j:

Real part = 3
Imaginary part = 4

Magnitude = √(3² + 4²) = √(9 + 16) = √25 = 5.

Therefore, abs(3 + 4j) returns 5.

Hence, the correct answer is Option C: 5.
34
What is the result of divmod(10, 3) ?
Discuss
Answer & Solution
Answer: Option A
Solution:
The divmod() function returns the quotient and remainder of division.
35
What is the result of len("Hello, World!") ?
Discuss
Answer & Solution
Answer: Option A
Solution:
The len() function returns the length of a sequence, such as a string.
36
What data type is the object below?
L = [1, 23, 'hello', 1]
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
37
What is the result of int("5") + float("2.5") ?
Discuss
Answer & Solution
Answer: Option A
Solution:
The int() and float() functions convert strings to the respective numeric types.
38
What is the result of round(0.5) - round(-0.5)?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
39
What is the result of round(3.14159, 2) ?
Discuss
Answer & Solution
Answer: Option A
Solution:
The round() function rounds a number to a specified number of decimal places.
40
Which of the following is incorrect?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board