Question

# Python Programming questions, Multiple Choice Questions: 5) MCQ What function call will generate a random number...

Python Programming questions, Multiple Choice Questions:

5) MCQ

What function call will generate a random number in the range of 1 through 6 using the random module?

a. random.randnum(1, 6)

b. random.randint(range(1-6))

c. random.randint(1, 6)

d. random.random(1, 6)

6) MCQ

In a conditional iteration loop, such as a while loop, what is a sentinel value?

a. A sentinel value is a user-provided input value that proceeds to the next loop.

b. A sentinel value is a user-provided input value that changes the structure of the loop.

c. A sentinel value is a special value provided by the user to terminate the loop.

d. A sentinel value is a special value provided by the user to restart the loop.

7) MCQ

What is NOT a Boolean or logical operator used in the Python language?

a. and

b. or

c. not

d. xor

8) MCQ

Assuming that the value of x is 4, and the value of y is 6, what is the value of the following expression? (x - y)**2 > y

a. True

b. False

c. Undefined

d. TypeError

5) random.randint(1,6) --- generated random number in the range of 1 through 6.(1 and 6 Both included)

other options are incorrect, since random has no attribute or method named randnum,randint expects two integers not a range instance.

6) A sentinel value is a user-provided input which is used as a signal to terminate a loop

Assume that a code expects continuous string inputs. lets say We use while loop to get continuous names untill we receive -1. The moment user enters -1 we come to know that user has entered all the data so we terminate while loop. Here -1 is the sentinel value.

7) xor isn't a boolean operator in python

8) Result will be False

x-y will be -2

(x-y)**2 will be -2 to the power of 2 which is 4

since 4 is not greater than 6 the answer will be False

#### Earn Coins

Coins can be redeemed for fabulous gifts.