Class XI : Chapter 1 Python Fundamental Test - 7

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.


2 comments:

  1. Replies
    1. Ans 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.

      Ans 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.

      Delete

Most Recently Published

File Handling Test 6

 File Handling Test 6 Q1 . Do we need to use the close() function when we use 'with' statement to open a file? Q2. Which mode you wi...

CS - IP Assignment/Worksheet