C Programming Random Number Generation 1 Online Exam Quiz

C Programming Random Number Generation 1 GK Quiz. Question and Answers related to C Programming Random Number Generation 1. MCQ (Multiple Choice Questions with answers about C Programming Random Number Generation 1

For the function call time(), what type of parameter is accepted?

Options

A : int

B : int *

C : time_t

D : time_t *

View Answer

Which is the correct way to generate numbers between minimum and maximum(inclusive)?

Options

A : minimum + (rand() % (maximum – minimum));

B : minimum + (rand() % (maximum – minimum + 1));

C : minimum * (rand() % (maximum – minimum))

D : minimum – (rand() % (maximum + minimum));

View Answer

Which among the following is correct function call for rand() and random()?

Options

A : rand() and random();

B : rand() and random(1);

C : rand(1) and random(1);

D : rand(1) and random();

View Answer

Which of the following snippet will effectively generate random numbers?

Options

A : rand();

B : rand(10);

C : rand(time(NULL));

D : all of the mentioned

View Answer

Which is the best way to generate numbers between 0 to 99?

Options

A : rand()-100

B : rand()%100

C : rand(100)

D : srand(100)

View Answer

Which of the following can be used for random number generation?

Options

A : random()

B : rnd()

C : rndm()

D : none of the mentioned

View Answer

What is the return type of rand() function?

Options

A : short

B : int

C : long

D : double

View Answer

rand() and srand() functions are used _____________

Options

A : To find sqrt

B : For and operations

C : For or operations

D : To generate random numbers

View Answer

Chemical Engineering Basics - Part 1 more Online Exam Quiz

C Programming Pointers Vs Multi Dimensional Arrays 2

C Programming Questions And Answers Structures Functions

C Programming Questions Goto Labels

C Programming Questions Macro Substitution

C Programming Questions Static Variables

C Programming Self Referential Structures 1

C Programming Sizeof Keyword 1

C Programming Sizeof Keyword 2

C Programming Storage Management 1

C Programming String Operations