CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

Functions (1 Mark Questions)

  1. Which of the following functions is a built-in function in python?
    • random()
    • sqrt()
    • factorial()
    • print()
  2. What is the area of memory called, which stores the parameters and local variables of a function call?
    • a heap
    • storage area
    • an array
    • None of these
  3. Is it necessary to use return statement inside a function? (Yes / No)
  4. print() is a:
    • Keyword
    • Identifier
    • User-Defined Function
    • built-in function
  5. stdout(), stdin(), stderr() are available in which module:
    • os
    • sys
    • python default
    • io
  6. What is the area of memory called, which stores the parameters and local variables of a function call?
    i)   a heap
    ii)  storage area
    iii) an array
    iv)  None of these
  7. What is the output of the following code :
    1
    2
    3
    4
    a = 1
    def f( ):                                                         
      a = 10
      print(a)
    
  8. Can a function return multiple values? How?
  9. When a global statement is used? Why is its use not recommended?
  10. Write a Python program to have the following features:
    1. A function that takes a number as an argument and calculates a cube for it. The function does not return a value.
    2. If there is no value passed to the above-created function i.e. 10(a) in the function call, the function should calculate the cube of 2.
    3. A function that takes two char arguments and returns True if both arguments are equal

No comments:

Post a Comment