Q.1: Which of the function return the smallest integer not less than number .
a) exp()
b) ceil()
c) floor()
d) fabs()
Q.2:Which of the following is not a type of function ?
a) built in function
b) function defined in modules
c) user defined function
d) python function
Q.3 : …………… is a reserved word for defining a function .
a) fun
b) def
c) define
d) pyfun
Q.4:What is the output of math.ceil(89.7)?
a) 90
b) 7
c) 89
d) 80
Q.5:What is the another name of parameters ?
a) formal argument
b) actual argument
c) actual parameters
d) none of these
Q.6: Out of the following ,which function should we use to generate random numbers between 1 and 5 ?
a) random()
b) randint()
c) range()
d) generate()
Q.7:What is the default value of a function that does not return any value ?
a) None
b) int
c) double
d) null
Q.8: A _______ is a file( .py file ) that contains variables , class , statements related to particular task.
a) function
b) module
c) docstring
d) none of these
Q.9:Which of the following is the form of import statement ?
a) import<module name>
b) from <module> import <object>.
c) import py.<module name>
d) all of these
Q.10:The help statement display __________ from a module .
a) constants
b) fuctions
c) classes
d) docstrings
Q.11: A ______ is a named block of statements that can be invoked by its name .
Q.12: The ______ function returns the largest integer not greater than number.
Q.13:The ______ module of python provides random number generation functionality .
Q.14:How are the following two statements differ from one another ?
a) Import maths
b) From maths import*
Q.15 :What is the utility of random module ?
Q.16 :What is the significance of modules?
Q.17: What is the role of an argument of a function?
Solution for Worksheet on Functions and modules in Python
Q.1: Which of the function return the smallest integer not less than number .
b) ceil()
Q.2:Which of the following is not a type of function ?
d) python function
Q.3 : …………… is a reserved word for defining a function .
b) def
Q.4:What is the output of math.ceil(89.7)?
a) 90
Q.5:What is the another name of parameters ?
a) formal argument
Q.6: Out of the following ,which function should we use to generate random numbers between 1 and 5 ?
b) randint()
Q.7:What is the default value of a function that does not return any value ?
a) None
Q.8: A __________ is a file( .py file ) that contains variables , class , statements related to particular task.
b) module
Q.9:Which of the following is the form of import statement ?
c) import py.<module name>
Q.10:The help statement display ______ from a module .
d) docstrings
Q.11: A _____ is a named block of statements that can be invoked by its name .
Answer : function
Q.12: The ______ function returns the largest integer not greater than number.
Answer : floor()
Q.13:The ______ module of python provides random number generation functionality .
Answer : random
Q.14:How are the following two statements differ from one another ?
a) Import maths and b) From maths import*
Answer:
When you type ‘import math’ you are importing all functions and classes in the math module but when you type ‘from math import [name of class]’, you only get access to that class in the whole module. you may write this ‘from math import *’ to import everything from the “from” statement
Q.15 :What is the utility of random module ?
Answer:
Python Random module is an in-built module of Python which is used to generate random numbers. These are pseudo-random numbers means these are not truly random. This module can be used to perform random actions such as generating random numbers, print random a value for a list or string, etc
Q.16 :What is the significance of modules?
Answer:
A module allows you to logically organize your Python code. Grouping related code into a module makes the code easier to understand and use. A module is a Python object with arbitrarily named attributes that you can bind and reference. Simply, a module is a file consisting of Python code.
Q.17: What is the role of an argument of a function?
Answer:
Arguments are inputs to functions; they allow a function to produce different (but appropriate) outputs for different inputs.The terms parameter and argument can be used for the same thing: information that are passed into a function. From a function’s perspective: A parameter is the variable listed inside the parentheses in the function definition. An argument is the value that are sent to the function when it is called.
Last updated on February 8th, 2022 at 11:26 amInput a list of numbers and find the smallest and largest number from the list Python Program #create empty list mylist = [] number = int(input(‘How many elements to put in List: ‘)) for n in range(number): element = int(input(‘Enter element ‘)) mylist.append(element) print(“Maximum element in…
Last updated on September 30th, 2022 at 10:41 pm2022-23 Informatics Practices Sample Paper Class 12 TIME: 3 /HOURS M.M.70 General Instructions: (1) This question paper contains five sections, Section A to E. (2) All questions are compulsory. (3) Section A have 18 questions carrying 01 mark each. (4) Section B has 07 Very Short…
Last updated on November 4th, 2023 at 10:23 amPython Program To Delete a Row in CSV File Method-1 You can delete a row in a CSV file in Python by reading the CSV file, excluding the row you want to delete, and then writing the remaining data back to the file. Here’s a Python…
Last updated on January 11th, 2022 at 11:12 pmCBSE Class 11 Computer Science Python Sample Paper 2021 Annual Examination (2020-21) Class-11 Subject: Computer Science Time allowed: 3:00 hours/ Maximum Marks:70 All questions are compulsory. 1- Name any two application software. (1) 2- Differentiate between compiler and interpreter? (2) 3- What do you…
Last updated on November 13th, 2021 at 07:06 pmCSV File MCQ Question Bank For Class 12 1. To open a file c:\scores.csv for reading, we use _______ command. a) infile = open(“c:\scores.csv”, “r”) b) infile = open(“c:\\scores.csv”, “r”) c) infile = open(file = “c:\scores.csv”, “r”) d) infile = open(file = “c:\\scores.csv”, “r”) …
Last updated on July 14th, 2021 at 11:20 pmClass 12 Computer Science Unit Test Paper Unit Test – I ( 2021-22) Q.1 a) Name the Python Library modules which need to be imported to invoke the following functions :- (1) i) sqrt ii) random b) Rewrite the following code in python after removing all syntax…