CNIT 155 3 & 4 QUESTIONS AND ANSWERS
num = randint(15,18) will generate a random integer from: - Answers -15,16,17,18
What is the term for a programming error? - Answers -bug
Which expression is written correctly?
5 * (7 + 4)
3(2a)
3(4 + 3)
2x - Answers -5 * (7+4)
If conditions are - Answers -Boolean Expressions
Which of the following is not true about the and operator?
It does not connect Boolean expressions.
The And operator is a logical operator.
It is evaluated to be True only if both operands are True.
The two operands must be Boolean expressions. - Answers -it does not connect
Boolean expressions
What is equal to n = n - 2? - Answers -n -= 2
What operators has the highest priority in an expression?
/
**
+
() - Answers -()
Which of the following is the right statement to import the random library in python? -
Answers -from random import *
Which of the following is NOT a type of error?
Run-Time error
Variable error
Syntax error
Logical Error - Answers -Variable error
What is the output of the following code?
n = 20
while (n <= 25):
print (n,"\n")
n = n+1 - Answers -20,21,22,23,24,25
num = randint(15,18) will generate a random integer from: - Answers -15,16,17,18
What is the term for a programming error? - Answers -bug
Which expression is written correctly?
5 * (7 + 4)
3(2a)
3(4 + 3)
2x - Answers -5 * (7+4)
If conditions are - Answers -Boolean Expressions
Which of the following is not true about the and operator?
It does not connect Boolean expressions.
The And operator is a logical operator.
It is evaluated to be True only if both operands are True.
The two operands must be Boolean expressions. - Answers -it does not connect
Boolean expressions
What is equal to n = n - 2? - Answers -n -= 2
What operators has the highest priority in an expression?
/
**
+
() - Answers -()
Which of the following is the right statement to import the random library in python? -
Answers -from random import *
Which of the following is NOT a type of error?
Run-Time error
Variable error
Syntax error
Logical Error - Answers -Variable error
What is the output of the following code?
n = 20
while (n <= 25):
print (n,"\n")
n = n+1 - Answers -20,21,22,23,24,25