Computer Science Class XI - Chapter 1 Python Fundamental Test 4

Computer Science Class XI - Chapter 1 Python Fundamental Test 4 

Q 1. What do you mean by Escape sequence?

Q 2. Write the output of the following

        a    >>> x = 2 + 5j

               >>> print(x.real, x.imag)

Q 3. What is None data type?

        

Q 4. Write the output of the following

        >>> v1 = 10

        >>> v2 = None

        >>> v1

        >>> v2

        >>>print(v2)

Q 5. What is the purpose of type() function?

Q 6. Write the output of the following.

        >>> type(10)

        >>>type('10')

        >>>type(10.0)

        >>>type(True)

        >>>type('False')

Q 7. Which function is used to find the data type of variable?

Q 8. Write the output of the following

        >>> a = "hello"

        >>> b = 10

        >>> c = 9.8

        >>> d = 7 + 3.6j

        >>> print(a)

        >>> print(b)

        >>> print(c)

        >>> print(d)

Q9. Identify the variable name, variable type, value and operator used in the following statement.

        >>> x = 9

Q 10. What do you mean by assignment operator?


 SOLUTIONS

Q 1. What do you mean by Escape sequence?

Ans The sequence of characters after backslash is called escape 

       sequence.

Q 2. Write the output of the following

        a    >>> x = 2 + 5j

               >>> print(x.real, x.imag)

Ans. 2.0 5.0

Q 3. What is None data type?

Ans. This data type is used to define null value or no value. 

        for example

        m = none, Now the variable 'm' is not pointing to any value, instead it 

        is pointing to none

Q 4. Write the output of the following

        >>> v1 = 10

        >>> v2 = None

        >>> v1

        >>> v2

        >>>print(v2)

Ans. 

10

None

Q 5. What is the purpose of type() function?

Ans. This function tell us about the data type of a variable. for example

a = 10

print(type(a))

OUTPUT : <class 'int'>

Q 6. Write the output of the following.

        >>> type(10)

        >>>type('10')

        >>>type(10.0)

        >>>type(True)

        >>>type('False')

Ans. <class 'int'>

        <class 'str'>

        <class 'float'>

        <class 'bool'>

        <class 'str'>

Q 7. Which function is used to find the data type of variable?

Ans. type() function

Q 8. Write the output of the following

        >>> a = "hello"

        >>> b = 10

        >>> c = 9.8

        >>> d = 7 + 3.6j

        >>> print(a)

        >>> print(b)

        >>> print(c)

        >>> print(d)

Ans

hello

10

9.8

7 + 3.6j

Q9. Identify the variable name, variable type, value and operator used in the following statement.

        >>> x = 9

Ans.

variable name -- x

variable type -- integer

value -- 9

operator -- =

Q 10. What do you mean by assignment operator?

Ans. An operator which is used to assign a value to a variable is called assignment operator. Symbol of assignment operator is '=', for example 

c = 10, value 10 will be assigned to variable 'c'

1 comment:

  1. Thank you sharing is helpful information, I am looking for Computer Science home classes classes and I think this blog is really helpful for me. Thank your and keep sharing.

    ReplyDelete

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