Homework-6

docx

School

J Sargeant Reynolds Community College *

*We aren’t endorsed by this school

Course

205

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

8

Uploaded by BaronTreeViper20

Report
CSC-208 Homework-6 1. A man has eight shirts, four pairs of pants, and five pairs of shoes. How many different outfits are possible? 8 shirts * 4 pants * 5 shoes = 160 different outfits. 2. How many times are the print statements executed? For i = 1 to m println(i) For j =1 to n println(j) The print statements are executed "m + n" times. 3. How many times is the print statement executed? for i = 1 to m for j = 1 to n println(i,j) he print statement is executed "m * n" times.
4. How many eight-bit strings read the same from either end? (An example of such an eight-bit string is 01111110. Such strings are called palindromes.) There are 16 eight-bit palindromes. 5. How many permutations are there of 11 distinct objects? 11! = 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 39,916,800 permutations. 6. How many 5-permutations are there of 11 distinct objects? P(11, 5) = 11! / (11 - 5)! P(11, 5) = 11! / 6! P(11, 5) = (11 x 10 x 9 x 8 x 7) / (6 x 5 x 4 x 3 x 2 x 1) P(11, 5) = 55440 7. In how many ways can we select a committee of four from a group of 12 persons? C(12, 4) = 12! / (4!(12 - 4)!)
C(12, 4) = 12! / (4!8!) C(12, 4) = (12 x 11 x 10 x 9) / (4 x 3 x 2 x 1) C(12, 4) = 495 8. In how many ways can five distinct Martians and eight distinct Jovians be seated at a circular table if no two Martians sit together. The number of ways to seat five distinct Martians and eight distinct Jovians at a circular table such that no two Martians sit together is 8! * 56 ways. 9. Suppose we have a set of 50 microprocessors of which four are defective. a. In how many ways can we select a set of four microprocessors? 211,876 ways b. In how many ways can we select a set of four non-defective microprocessors? 15,596 ways c. In how many ways can we select a set of four microprocessors containing exactly two defective microprocessors? 6,210 ways d. In how many ways can we select a set of four microprocessors containing at least one defective microprocessor?
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
196,280 ways 10. Suppose we have an experiment where a coin is flipped and a die is rolled and the result of the coin flip and die roll is noted. a. What is the sample space? Sample Space (S) = {(H, 1), (H, 2), (H, 3), (H, 4), (H, 5), (H, 6), (T, 1), (T, 2), (T, 3), (T, 4), (T, 5), (T, 6)} b. Define an event A as the coin shows a head and the die show an even number. List the elements of the event A. Event A (A) = {(H, 2), (H, 4), (H, 6)} c. Define an event B as the die shows an odd number. List the elements of event B. Event B (B) = {(H, 1), (H, 3), (T, 1), (T, 3), (T, 5)} d. Define an event C as the coin shows a head and the die shows a number less than 4. List the elements of event C. Event C (C) = {(H, 1), (H, 2), (H, 3} 11. A card is selected at random from an ordinary 52 card deck. a. What is the probability that the card is the ace of spades?
1/52 b. What is the probability that the card selected is a jack? 1/13 c. What is the probability that the card is a heart? 1/4 12. Two fair die are rolled. a. What is the probability that the sum of the numbers showing on the dice is a 9? Probability of the sum being 9: 1/9 b. What is the probability that the sum of the numbers showing on the dice is odd? Probability of the sum being odd: 1/3 c. What is the probability of doubles? Probability of getting doubles: 1/6 13. Six microprocessors are randomly selected from a lot of 100 microprocessors among which 10 are defective. Find the probability of obtaining no defective microprocessors. The probability of obtaining no defective microprocessors when selecting 6 from a lot of 100 microprocessors with 10 defective ones is approximately 63% or exactly 63.84%
14. If a coin is flipped 10 times what is the probability of no heads? The probability of getting no heads in 10 coin flips is 1/1024, or approximately 0.0977%. 15. If a coin is flipped 10 times what is the probability of at least one head? The probability of getting at least one head when flipping a coin 10 times is approximately 99.9%. 16. If a coin is flipped 10 times what is the probability of approximately 5 heads, that is, exactly 4 or 5 or 6 heads? The probability of getting exactly 4, 5, or 6 heads when flipping a coin 10 times is approximately 59%. 17. If a coin is flipped 10 times what is the probability of approximately 5 heads, that is, exactly 4 or 5 or 6 heads given at least one head? The probability of getting exactly 4, 5, or 6 heads when flipping a coin 10 times and given that at least one head has occurred is approximately 99%.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
18. Find the coefficient of the s 6 t 6 term when the expression ( 2 s t ) 12 is expanded. C(12, 6) * (2s)^6 * (-t)^6 C(12, 6) = 12! / (6!(12-6)!) = 12! / (6!6!) = (12 * 11 * 10 * 9 * 8 * 7) / (6 * 5 * 4 * 3 * 2 * 1) = 924. 924 * (2^6) * (-1^6) = 924 * 64 * (-1) = -59264. 19. Expand ( x + y ) 6 using the binomial theorem. Expand: (a + b)^n = C(n, 0) * a^n * b^0 + C(n, 1) * a^(n-1) * b^1 + C(n, 2) * a^(n-2) * b^2 + ... + C(n, n) * a^0 * b^n Expand with a=x, b=y, and n=6, so in last expand with (x+y)^6 C(6, 0) * x^6 * y^0 + C(6, 1) * x^5 * y^1 + C(6, 2) * x^4 * y^2 + C(6, 3) * x^3 * y^3 + C(6, 4) * x^2 * y^4 + C(6, 5) * x^1 * y^5 + C(6, 6) * x^0 * y^6 Expand and calculate with binomial coefficients C(n,k): C(6, 0) = 1 C(6, 1) = 6 C(6, 2) = 15 C(6, 3) = 20 C(6, 4) = 15 C(6, 5) = 6 C(6, 6) = 1 Nevertheless, substitute the values into the expansion: 1 * x^6 * y^0 + 6 * x^5 * y^1 + 15 * x^4 * y^2 + 20 * x^3 * y^3 + 15 * x^2 *y^4 + 6 * x^1 * y^5 + 1 * x^0 * y^6
Answer: x^6 + 6x^5y + 15x^4y^2 + 20x^3y^3 + 15x^2y^4 + 6xy^5 + y^6 20.Prove that among a group of six students, at least two received the same grade on the final exam. ( The grades assigned were chosen from A, B, C, D, F.) Among a group of six students with five possible grades (A, B, C, D, F), at least two students must have received the same grade on the final exam.