Describe a possible sample space and determine its size for each of the followin
ID: 3202367 • Letter: D
Question
Describe a possible sample space and determine its size for each of the following experiments: The following for loop is executed in a program. p is a variable that can be either TRUE or FALSE each time through the loop, A and B are statements that can be executed. In how many ways, can exactly 4 A's occur? for (int i 0; i 13; i++) if (p == TRUE) A; else B;} We pick a random number from the set of odd numbers with distinct digits between 100 and 1000. We pick a random positive integer less than 4,000 that has exactly one 8. Three students stop by at a library in sequence and each plan to borrow four books to read. There are n distinct books (n greaterthanorequalto 12) available at the library (after a book is taken by the first student, it becomes unavailable to the second and third student We are interested in the number of possible ways that twelve books could be borrowed.Explanation / Answer
(A)
In this experiment, statement A will be executed only if p=TRUE
for exactly 4 occurrances of A, p has to be TRUE for exactly 4 times.
In all 13 different executions, p can be TRUE in 13C4 ways i.e. 715
In this experiment, sample space is 2C1 * 13 = 2^13 = 8192
(B)
There are total 450 odd numbers between 100 and 1000.
A number will be odd if its last digit is 1, 3, 5, 7 or 9.
Hence number of odd digits with distinct digits are = 5C1 * 9C1 * 7C1 = 5*9*7 = 315
5C1 indicates the selection of last digit which has to be odd
9C1 indicates the selection of middle digit which can be anything except the last digit hence there are only 9 possibilities
7C1 indicates the selection of 1st digit which can be different from last two digits and 0
(C)
There are total 3999 positivve integers which are less than 4000
In case of single digit numbers, there is only 1 number which has exactly one 8
In case of two digit numbers, there are 9C1 + 8C1*1 = 9+8 = 17
In case of three digit numbers, there are 9C1*9C1 + 8C1*9C1 + 8C1*9C1 = 81 + 72 + 72 = 225
In case of four digit numbers, there are 3C1*{9C1*9C1 + 8C1*9C1 + 8C1*9C1} = 3*225 = 675
Total number of numbers with exactly one 8 = 1 + 17 + 225 + 675 = 918
(D)
When 1st student arrives he/she selects 4 books from n books in nC4 ways.
Now for 2nd student n-4 books are available, he/she can select 4 books in (n-4)C4 ways
Similarly, for 3rd student n-8 books are available, he/she can select 4 books in (n-8)C4 ways
hence total number of ways books can be selected are nC4 + (n-4)C4 + (n-8)C4