MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Pseudorandom Number Generators Multiple Choice knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which header file contains the function rand() in C language? |
| A. | stdlib |
| B. | iostream |
| C. | stdio |
| D. | time |
| Answer» B. iostream | |
| 2. |
Pseudo random number generators can be used for data encryption. |
| A. | true |
| B. | false |
| Answer» C. | |
| 3. |
What is the default value of seed if function rand() is called before srand()? |
| A. | srand(0) |
| B. | srand(1) |
| C. | srand(time(null)) |
| D. | srand(-1) |
| Answer» C. srand(time(null)) | |
| 4. |
Function rand() generates unique random numbers every time. |
| A. | true |
| B. | false |
| Answer» C. | |
| 5. |
What is the minimum value of RAND_MAX possible in any implementation? |
| A. | 0 |
| B. | 32767 |
| C. | 2147483647 |
| D. | 128 |
| Answer» C. 2147483647 | |
| 6. |
Which of the following will generate random numbers in the range 1-100 (both inclusive)? |
| A. | rand() % 100 |
| B. | rand() % 101 |
| C. | (rand() % (101)) + 1 |
| D. | (rand() % (100)) + 1 |
| Answer» E. | |
| 7. |
5.What is the correct formula for generating random numbers in the range (lower,upper) using rand()? |
| A. | rand() % (upper lower) |
| B. | rand() + lower |
| C. | (rand()%(upper-lower)) + lower |
| D. | (rand()%(upper-lower+1)) + lower |
| Answer» E. | |
| 8. |
What is the range of rand()? |
| A. | 0 to RAND_MAX |
| B. | 0 to infinity |
| C. | 0 to 2147483647 |
| D. | 0 to 32767 |
| Answer» B. 0 to infinity | |
| 9. |
What is the purpose of using function srand()? |
| A. | to set the seed of rand() function |
| B. | to generate random numbers |
| C. | to enable rand() function |
| D. | to improve efficiency of rand() |
| Answer» B. to generate random numbers | |
| 10. |
What should be the return type of rand() function? |
| A. | int |
| B. | float |
| C. | long |
| D. | double |
| Answer» B. float | |
| 11. |
What is pseudo random number generator? |
| A. | an algorithm that generates random numbers with help of mathematical formula |
| B. | an algorithm that generates random numbers according to user activity |
| C. | an algorithm that generates random numbers according to time |
| D. | an algorithm that generates random numbers with help of user input |
| Answer» B. an algorithm that generates random numbers according to user activity | |