

MCQOPTIONS
Saved Bookmarks
This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.
1. |
What will be the output of the following Python function, assuming that the random library has already been included? |
A. | Randomized list containing the same numbers in any order |
B. | The same list, that is [1,2,24] |
C. | A list containing any random numbers between 1 and 24 |
D. | ErrorView Answer |
Answer» E. | |
2. |
The randrange function returns only an integer value. |
A. | True |
B. | False |
Answer» B. False | |
3. |
Both the functions randint and uniform accept ____________ parameters. |
A. | 0 |
B. | 1 |
C. | 3 |
D. | 2 |
Answer» E. | |
4. |
What is the interval of the value generated by the function random.random(), assuming that the random module has already been imported? |
A. | (0,1) |
B. | (0,1] |
C. | [0,1] |
D. | [0,1) |
Answer» E. | |
5. |
Which of the following functions helps us to randomize the items of a list? |
A. | seed |
B. | randomise |
C. | shuffle |
D. | uniform |
Answer» D. uniform | |
6. |
What will be the output of the following Python function if the random module has already been imported? |
A. | Error |
B. | Any integer between 3.5 and 7, including 7 |
C. | Any integer between 3.5 and 7, excluding 7 |
D. | The integer closest to the mean of 3.5 and 7View Answer |
Answer» B. Any integer between 3.5 and 7, including 7 | |
7. |
What will be the output of the following Python function, assuming that the random module has already been imported? |
A. | Error |
B. | Either 3 or 4 |
C. | Any integer other than 3 and 4 |
D. | Any decimal value between 3 and 4View Answer |
Answer» E. | |
8. |
What will be the output of the following Python function (random module has already been imported)? |
A. | sun |
B. | u |
C. | either s, u or n |
D. | ? a) sunb) uc) either s, u or nd) errorView Answer |
Answer» D. ? a) sunb) uc) either s, u or nd) errorView Answer | |
9. |
The output of the following Python code is either 1 or 2. |
A. | True |
B. | FalseView Answer |
Answer» B. FalseView Answer | |
10. |
To include the use of functions which are present in the random library, we must use the option: |
A. | import random |
B. | random.h |
C. | import.random |
D. | random.random |
Answer» B. random.h | |
11. |
su? |
A. | u |
B. | either s, u or n |
C. | error |
Answer» C. error | |
12. |
An integer other than 2, 3 and 4 |
A. | Either 2, 3 or 4 |
B. | Error |
C. | 3 only |
Answer» D. | |