Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (a) (i) What are pseudo-random numbers? (ii) Explain way it is neccssary to sced a random-number generator. 1] (b) In the manufacture of electric

image text in transcribed

3. (a) (i) What are pseudo-random numbers? (ii) Explain way it is neccssary to "sced a random-number generator". 1] (b) In the manufacture of electric bulbs, the probability that a bulb is defective is 0.01. Write a program to simulate the manufacture of 5000 bulbs, indicating how many are defective. Ensure that each time your program is run, a different answer could be obtained. marbles of various colours. Marbles are picked at A barrel contains a large number of random from the barrel. There is a 50% chance of picking a red marble, a 20% chance ofpicking a blue marble, a 20% chance of picking a green marble, a 5% chance of picking a yellow marble and a 5% chance of picking a black marble. Assume that these percentages do not change after a marble is picked. (c) Write a program to perform 25 simulations of the picking of marbles until at least o marble of each colour is picked. For each simulation, print the number of marbles picked. Also print the average number of marbles picked per simulation. State THREE differences between integers stored in a text file and integers stored in a binary file. (d) A retailer wishes to keep records of the items he sells. He has a text data file, items.txt, containing, on each line, an item number (integer), the quantity in stock (integer) and the unit price (real). The last line contains only, indicating the end of the data. (e) Write a program to read the data (using fscanf) and store each item record in a binary file, items.bin. The records are to be stored in the same order as they appear in the text file. Your program should check if the input file could be opened and the output file could be created. 15) Total Marks Q3: 20

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Why is practice so important when preparing a presentation?

Answered: 1 week ago