Recents in Beach

JESUS & MARY ACADEMY

AI and YOU 7 Chapter 7. More on Python only Exercise.

Chapter: 07 More on Python.

A.    Tick the correct answers

1.     This function makes the program interactive.

a.     print() function

b.     input() function

c.     Assignment operator

Answer: ( b ). Input() function

2.     These are the values on which the operations works.

a.       Operands  b.       Variables      c.       Numbers

Answer: Operands

3.     Which of the following is correct to take input of age from the user in integer from?

a.         age=input(“Enter your age”)

b.         age=int(input(“Enter your age”))

c.         age=input(int(“Enter your age”))

Answer: ( b ).  age=int(input(“Enter your age”))

4.     What will be the output of the expression: x>=y and x==y, if x=10, y=10?

a.        True                    b.       False            c.        Error

Answer: ( a ). True

5.     What will be the output of the expression: print (“50”+”70”)?

a.     50 70            b.       5070             c.       120

Answer: ( b ). 5070

B.    Fill in the blanks.

1.     In the expression 112+34, + (binary) is the operator.

2.     Operators that work on two operands are called binary operators.

3.     Unary operator and binary operator are two types of arithmetic operators.

4.     () parenthesis operators work on text as well as numbers enclosed within inverted commas.

5.     Plus (+) and Multiplication (*) are two types of string operators.

C.    Write T for True and F for False.

1.     Preference is given to higher precedence operators.        T

2.     You can use unary operators on more then three operands.       F

3.     To calculate the power of numbers, exponential operators are used.     T

4.     The input () function allows you to take input from users.  T

5.     A>b is a relational expression. T

D.    Answer the following questions.

1.     Explain the term operator?

Answer: The operator can be defined as a symbol which is responsible for a particular operation between two operands. Operators are the pillars of a program on which the logic is built in a specific programming language. Python provides a variety of operators, which are described as follows.

o   Arithmetic operators

o   Comparison operators

o   Assignment Operators

o   Logical Operators

o   Bitwise Operators

o   Membership Operators

o   Identity Operators

 

2.     What is the difference between relational operator and assignment operator?

Answer: Relational operators are used to perform comparison operations. . Assignment operator is used to assign value of the second operand to first. Conditional operators operate on a condition and return result based on the truth value of condition.

 

3.     What is the use of ‘*’ operator in string manipulation?

Answer: ‘*’ (multiplication) operator is used for replicating a given string a number of times. It is also known as replication operator.

4.     Describe unary operator in brief.

Answer: Unary operator defined as there are the operators which operate only one operand. For example:- i = -100, j = +500

5.     What is PEDMAS?

Answer: PEMDAS is an acronym for the words parenthesis, exponents, multiplication, division, addition, subtraction. Given two or more operations in a single expression, the order of the letters in PEMDAS tells you what to calculate first, second, third and so on, until the calculation is complete. If there are grouping symbols in the expression, PEMDAS tells you to calculate within the grouping symbols first.

 

Post a Comment

0 Comments