Skip to main content
Chapter 7 of 11
NCERT Solutions

Functions

CBSE · Class 11 · Computer Science

NCERT Solutions for Functions — CBSE Class 11 Computer Science.

42 questions80 flashcards5 concepts

Interactive on Super Tutor

Studying Functions? Get the full interactive chapter.

Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for ncert solutions and more.

1,000+ Class 11 students started this chapter today

7 Questions Solved · 1 Section

4 worked solutions below. Unlock all 7 free in Super Tutor

EXERCISE

1Observe the following programs carefully, and identify the error:Show solution
a) The error is in the function call: `create(5)` passes only one argument, but the function is defined as `create(text, freq)`, so it needs 2 arguments.

b) `cos()` is used but it is not imported. The program imports only `sqrt` and `ceil` from `math`, so `cos` will cause an error. It should import `cos` too, or use `math.cos(0)` after importing `math`.

c) The function tries to modify `mynum` inside the function without declaring it global. So `mynum = mynum + 9` causes an error because Python treats `mynum` as a local variable, but it is used before assignment. It should use `global mynum` inside the function if the global variable is to be changed.

d) The function header is incorrect because a parameter with a default value must be the trailing parameter. Here `val1 = 1.1` comes before `val2` and `val3`, which is not allowed. Also, the function call is written as `findvalue()` but the function name is `findValue()`.

e) The function call is written incorrectly. `greet() = message` is invalid because a function call cannot be on the left side of assignment. It should be `message = greet()`.

Not sure why a step works? check your working in Super Tutor

2How is math.ceil(89.7) different from math.floor(89.7)?Show solution
`math.ceil(89.7)` gives the smallest integer greater than or equal to 89.7, so it is 90.

`math.floor(89.7)` gives the greatest integer less than or equal to 89.7, so it is 89.

So, ceil rounds up and floor rounds down.

Not sure why a step works? check your working in Super Tutor

3Out of random() and randint(), which function should we use to generate random numbers between 1 and 5. Justify.Show solution
We should use `randint()` because it generates a random integer in a given range. For numbers between 1 and 5, `randint(1,5)` will return an integer from 1 to 5, including both ends.

`random()` gives a random real number between 0.0 and 1.0, so it is not suitable for directly generating integers from 1 to 5.

Not sure why a step works? check your working in Super Tutor

4How is built-in function pow() function different from function math.pow() ? Explain with an example.Show solution
The built-in `pow()` function and `math.pow()` both compute powers, but they differ in return type and usage.

- `pow(x, y)` is a built-in function. It returns xyx^y.
- `math.pow(x, y)` belongs to the math module. It also returns xyx^y, but as a float.

Example:
- `pow(5, 2)` gives 25
- `math.pow(5, 2)` gives 25.0

Also, `math.pow()` requires importing the math module.

Not sure why a step works? check your working in Super Tutor

5Using an example show how a function in Python can return multiple values.
6Differentiate between following with the help of an example:
7Does a function always return a value? Explain with an example.

3 more solved questions in Functions

Every remaining exercise is solved step by step in Super Tutor, plus practice quizzes and flashcards for this chapter. Free to start.

Stuck on a step?

Ask Super Tutor AI to explain any solution on this page in a simpler way — free, 24x7.

Ask a Doubt Free

Frequently Asked Questions

What are the important topics in Functions for CBSE Class 11 Computer Science?
Functions covers several key topics that are frequently asked in CBSE Class 11 board exams. Focus on the core concepts listed on this page and practise related questions to build confidence.
How to score full marks in Functions — CBSE Class 11 Computer Science?
Understand the core concepts first, then work through the 42 practice questions available for this chapter. Revise formulas and definitions regularly, and use flashcards for quick recall before the exam.
Where can I get free NCERT Solutions for Functions Class 11 Computer Science?
This page has free step-by-step NCERT Solutions for every exercise question in Functions (CBSE Class 11 Computer Science) — written the way examiners award marks: given, formula, working, answer.

Sources & Official References

Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.

For serious students

Get the full Functions chapter — for free.

Quizzes, flashcards, AI doubt-solver and a step-by-step study plan for CBSE Class 11 Computer Science.