: A computer program is tested by 3 independent tests. When there is an error, these tests will
discover it with probabilities 0.2, 0.3 and 0.5, respectively. Suppose that the program contains an
error. What is the probability that it will be found by at least one test.
A diagnostic test has a probability 0.95 of giving a positive result when applied to a person suffering from a certain disease, and a probability0.10 of giving a (false) positive when applied to a non- sufferer. It is estimated that 0.5 % of the population are sufferers. Suppose that the test is now administered to a person about whom we have no relevant information relating to the disease (apart from the fact that he/she comes from this population). Calculate the following probabilities:
(a) that the test result will be positive.
(b) that, given a positive result, the person is a sufferer.
(c) that, given a negative result, the person is a non-sufferer.
The computers of six faculty members in a certain department are to be replaced. Two of the faculty members have selected laptop machines and the other four have chosen desktop machines. Suppose that only two of the setups can be done on a particular day, and the two computers to be set up are randomly selected from the six (implying 15 equally likely outcomes; if the computers are numbered 1, 2,…, 6, then one outcome consists of computers 1 and 2, another consists of computers 1 and 3, and so on).
a. What is the probability that both selected setups are for laptop computers?
b. What is the probability that both selected setups are desktop machines?
c. What is the probability that at least one selected setup is for a desktop computer?
d. What is the probability that at least one computer of each type is chosen for setup?
Write a program to implement the Date class which has three data members named day, month and year.
1. Provide a constructor, which takes arguments (you may set values of data members to 0).
2. Write getter and setter functions (input and show functions) for the Date class.
3. Also write a member function void CompareDates(Date d1, Date d2) which tells which date comes first.
Example output:
13/11/2009 comes before 20/12/2009
Create a class named ‘Rectangle’, Triangle and Square.
Rectangle class:
Data Members: length, width and area
Functions:input() ,area_Calculator()
Square class:
Data Members: length,area
Functions :input() , area_Calculator()
Triangle class:
Data Members: base,hieght,area
Functions :Input() , area_Calculator()
Compare their areas in a friend function and tell which shape has greatest area.
Area of rectangle: length*width;
Area of triangle: ½(base*height);
Area of square: (length)2
Create a class named ‘CalculateArea’ to calculate the area of three different diagrams i.e. Rectangle, Triangle and a Square using function overloading.
First prompt the user to select the diagram for which he wants the area:
Press 1 for Rectangle
Press 2 for Triangle
Press 3 for Square
After the selected option, call the respective function of the selected diagram and print the area.
Area of rectangle: length*width;
Area of triangle: ½(base*height);
Area of square: (length)2
Write a program that creates a class called student. The data members of the class are name and age.
· Create a nullary constructor and initialize the class object.
· Create a parameterized constructor that can set the values being passed from the main function.
· Create a display function called showall( ) which will be used to show values that have been set.
Use the default copy constructor to show that copying of simple objects can be accomplished through the use of the default copy constructor.
a) How many three-digit numbers can be formed from the digits 0, 1, 2, 3, 4, 5, and 6 if each digit
can be used only once? (05)
(b) How many of these are odd numbers? (05)
(c) How many are greater than 330?
Write a Python program that accepts a string and calculate thenumber of digits and letters
Sample Data : Python 3.9
Expected Output :
Letters 6
Digits 2
Write a Python program to convert temperatures to and from celsius, fahrenheit.
[ Formula : c/5 = f-32/9 [ where c = temperature in celsius and f = temperature in fahrenheit ]
Expected
Output :
60°C is 140 in Fahrenheit
45°F is 7 in Celsius