Q: What the does random.seed(3) return?
Solution: The function random.seed() always returns a None.
Q: Which of the following cannot be returned by random.randrange(4)?
Solution: Only integers can be returned.
Q: Which of the following is equivalent to random.randrange(3)?
Solution: It returns one number from the given range.
Q: The function random.randint(4) can return only one of the following values. Which?
Solution: Error, the function takes two arguments.
Q: Which of the following is equivalent to random.randint(3, 6)?
Solution: random.randint(3, 6) can return any one of 3, 4, 5 and 6.
Q: Which of the following will not be returned by random.choice(“1 ,”)?
Solution: Any of the characters present in the string may be returned.
Q: Which of the following will never be displayed on executing print(random.choice({0: 1, 2: 3}))?
Solution: It will not print 0 but dict[0] i.e. 1 may be printed.
Q: What does random.shuffle(x) do when x = [1, 2, 3]?
Solution: The elements of the list passed to it are shuffled in-place.
Q: Which type of elements are accepted by random.shuffle()?
Solution: Strings and tuples are immutable and an integer has no len().
Q: What is the range of values that random.random() can return?
Solution: Any number that is greater than or equal to 0.0 and lesser than 1.0 can be returned.
You Have Score    | /10 |