Q1. Out of relational and arithmetic operators which have higher precedence?
Q2. Write the output of the following
>>>35 < 6
>>>5 > 2**2
>>>7 != 3.5 *2
>>>7 == 3.5 ** 2
>>> "Anil" > "Anita"
Q3. What do you mean by shorthand operator?
Q4. Write the output of the following if x = 8.
>>> x + = 8
>>> x - = 8
>>> x * = 8
>>> x ** = 2
>>> x % = 8
>>>x / = 8
>>> x // = 8
Q5. What is the purpose of input function?
Q6. Write a program to accept name from the user and display "Hello <name>"
Q7. Write a program to accept the first name and last name from user and display the full name.
Q8. Write a program to accept two numbers from the user and display their sum and product.
Please share answers with us
ReplyDeleteAns 1: Arithmetic operators are used to perform mathematical operations. Relational operators are used to perform comparison operations. Arithmetic operators have higher precedence than relational operators.
DeleteAns 2: (a.)false (b.) true
(c.) false (d.) false (e.) false
Ans 3: Shorthand operator is a shorter way to express something. We can use shorthand for not writing the whole statement, like ~ a=a + 1, we can and write it as a+=1.
Ans 4: (a.)16 (b.)0 (c.)64 (d.)64 (e.)0 (f.)1.0 (g.)1.0
Ans 5: It is used to take value from the user.