Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 345 - 346 of 354

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 345

C & C Plus Plus

Describe in Detail


How would you use the functions randomize () and random () ?


randomize () :

  • Randomize initializes the random number generator with a random value.
  • Randomize is implemented as a macro that calls the time function prototyped in time. h
  • Include time. h when we use this routine

random () :

  • The function random () returns a pseudo random integral number.
  • This number will be in the range 0 to RAND_MAX.
  • The algorithm of rand () uses a seed to generate the series of numbers based on a seed- srand must be used to initialize the seed to some distinctive value.
  • The constant RAND_MAX is defined in standard library.
  • Return value:
  • Will return an integer value between 0 and RAND_MAX.

Question 346

C & C Plus Plus



Purpose of PC (Program Counter) in a Microprocessor is


Choice (4)


To store address of next instruction to be executed


Count the number of instructions


To store base address of the stack


To store address of TOS (Top Of Stack)




The program counter, PC, is a special-purpose register that is used by the processor to hold the address of the next instruction to be executed. It automatically gets incremented to point to the next instruction during the op-code decode cycle. When computer is reset or gets restarted, Program Counter normally reverts to 0.

Developed by: