D.
Very Short Answer Questions
1. What are operands?
Operands are the values or variables on which an operator acts.
For example, in a + b, a and b are operands.
2. Give an example of AND operator.
Example: True and False will return False.
3. What is a bug?
A bug is an error in a program that prevents it from functioning as expected.
E. Short Answer Questions
1. What is associativity?
Associativity defines the direction in which an operator is evaluated in an
expression when two operators of the same precedence appear. It can be
left-to-right or right-to-left.
2. Differentiate between logical and syntax error.
Logical Error: The program runs but produces incorrect results due to an error
in logic.
Syntax Error: The program does not run because it violates the rules of the
programming language.
F. Long Answer Questions
1. List relational operators and explain their meaning:
==: Checks if two values are equal.
!=: Checks if two values are not equal.
>: Checks if the left value is greater than the right value.
<: Checks if the left value is less than the right value.
>=: Checks if the left value is greater than or equal to the right value.
<=: Checks if the left value is less than or equal to the right value.
2. Define concatenation operator.
The concatenation operator (+) is used to combine two strings into one.
Example: "Hello" + " World" results in "Hello World".
3. Explain the use of operator precedence in Python with an
example.
Operator precedence determines the order in which operators are evaluated.
Example: 5 + 3 * 2
Here, * (multiplication) is evaluated first, so the result is 5 + 6 = 11.
4. Write a Python program using logical operators:
# Program to check if two numbers are equal
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
if a == b:
print("Both numbers are equal")
else:
print("Numbers are not equal")
G. Computer in Everyday Life
1. Ans:- Operator to compare two numbers:
Use the == operator to check if one number is equal to another.
2) Ans:- Program to display result if condition is true:
number = int(input("Enter a number: "))
if number > 10:
print("Condition is True")