NCERT Solutions Class 11 Computer Science Chapter 6 – Flow of Control

In Orchids International School, we prepare students with all the resources for their academic success. Class 11 Computer Science goes into minute detail regarding concepts involved in class 11 Computer Science Chapter 6. This chapter is called Flow of Control. It deals with the most basic programming constructs related to controlling the flow of execution of instructions by a computer. We help our students with high-quality materials, including a class 11 Computer Science Chapter 6 PDF. This enables them to gain an overview of the various control structures such as loops, conditionals, and function calls. So, in learning these, they master the skill of problem-solving and coding toward computer science. At Orchids International School, we believe that our students should be well-prevised with the necessary knowledge and tools for excelling in their academic journey.

Download PDF For NCERT Solutions for Computer-Science Flow of Control

The NCERT Solutions Class 11 Computer Science Chapter 6 – Flow of Control are tailored to help the students master the concepts that are key to success in their classrooms. The solutions given in the PDF are developed by experts and correlate with the CBSE syllabus of 2023-2024. These solutions provide thorough explanations with a step-by-step approach to solving problems. Students can easily get a hold of the subject and learn the basics with a deeper understanding. Additionally, they can practice better, be confident, and perform well in their examinations with the support of this PDF.

Download PDF

Access Answers to NCERT Solutions Class 11 Computer Science Chapter 6 – Flow of Control

Students can access the NCERT Solutions Class 11 Computer Science Chapter 6 – Flow of Control. Curated by experts according to the CBSE syllabus for 2023–2024, these step-by-step solutions make Computer-Science much easier to understand and learn for the students. These solutions can be used in practice by students to attain skills in solving problems, reinforce important learning objectives, and be well-prepared for tests.

Flow of Control

Question 1 :

What is the purpose of range() function? Give one example.

 

Answer :

Function range() is used for creating a list containing the integer values in sequence from start value to stop value. Sometimes it is used for generating the number sequentially in for loop.

Example:

for val in range (0,8):

print(val)

 

 


Question 2 :

What is the difference between else and elif construct of if statement?

Answer :

Else

elif

Else is a part of the if statement.

The elif is short for else if.

Else statement is executed whenever the 

if statement is getting false.

  Elif executes the  block of code whenever one of the conditions are true.

Example:

If(a<b)

Print “a less than b”

Else

Print “ a is not less than b”

 

Example:

If num> 0;

Print “positive number”

Elifnum == 0;

Print “zero”

Else:

Print “negative number”

 

 

 


Question 3 :

Differentiate between break and continue statements using examples.

 

Answer :

 

Break Statement

Continue Statement

Break statement is to break the loop.

Continue statement is used to to continue the loop

Break statement is used with switch statement

Continue statement is not used with switch statements

Keyword: break

Keyword: continue

 


Question 4 :

What is an infinite loop? Give one example.

 

Answer :

  • Infinite loop execute when while condition never become false

  • If condition remain true. the loop will never get terminated.

  • The control enters in loop and keeps repeating the same block code and loop never end.

Example:

a = 1

while a==1:

b = input(“what’s your birthdate?”)

print(“your birthdate is ”, b)

Output:

What’s your birthdate?

13

your birthdate is 13

What’s your birthdate?

14

your birthdate is 14

What’s your birthdate?

15

your birthdate is 15

What’s your birthdate?

16

your birthdate is 16

 


Question 5 :

Find the output of the following program segments:

 

Answer :

(i) a = 110

while a > 100:

print(a)

a  -= 2

Output: 110

108

106

104

(ii) for i in range(20,30,2):

print(i)

Output: 20
22
24
26
28

(iii) country = ‘INDIA’

for i in country:

print (i)

Output:

I
N
D
I
A

(iv) i = 0; sum = 0

while i < 9:

if i % 4 == 0:

sum = sum + i

i = i + 2

print (sum)

Output: 12

  1. v) for x in range(1,4):

for y in range(2,5):

if x * y > 10:

break

print (x * y)

Output:

2
3
4
4
6
8
6
9

(v) var = 7

whilevar> 0:

print (‘Current variable value: ‘, var)

var = var -1

if var == 3:

break

else:

if var == 6:

var = var -1

continue

print (“Good bye!”)

Output:

Current variable value:  7
Current variable value:  5
Good bye!
Current variable value:  4

 


Programming Exercises

Question 1 :

Write a program to check if the year entered by the user is a leap year or not.

 

Answer :


Question 2 :

Write a program to generate the sequence: –5, 10, –15, 20, –25….. upto n, where n is an integer input by the user.

 

Answer :


Question 3 :

Write a program that takes the name and age of the user as input and displays a message whether the user is eligible to apply for a driving license or not. (the eligible age is 18 years).

 

Answer :


Question 4 :

Write a function to print the table of a given number. The number has to be entered by the user.

 

Answer :


Question 5 :

Write a program that prints minimum and maximum of five numbers entered by the user.

 

Answer :


Question 6 :

Write a program to find the sum of 1+ 1/8 + 1/27.

 

Answer :


Question 7 :

Write a program to find the sum of digits of an integer number, input by the user.

 

Answer :


Question 8 :

Write a function that checks whether an input number is a palindrome or not. [Note: A number or a string is called palindrome if it appears the same when written in reverse order also. For example, 12321 is a palindrome while 123421 is not a palindrome]

 

Answer :

Program:

rev = 0
n = int(input(“Enter the number: “))
temp = n

while temp > 0:
digit = (temp % 10)
rev = (rev * 10) + digit
temp = temp // 10

if(n == rev):
print(“The number is a palindrome.”)
else:
print(“The  number is not a palindrome.”)

output:

Enter the number: 5665

The number is a palindrome.

 


Question 9 :

Write a program to print the following patterns

Answer :

(ii)

(iii)

(iv)

 


Question 10 :

Write a program to find the grade of a student when grades are allocated as given in the table below. Percentage of the marks obtained by the student is input to the program.

 

Percentage of Marks 

Grade

Above 90%

A

80% to 90%

B

70% to 80%

C

60% to 70%

D

Below 60%

E

 

Answer :

Program:

OUTPUT:

n = float(input(‘Enter the percentage of the student: ‘))

if(n > 90):
print(“Grade A”)
elif(n > 80):
print(“Grade B”)
elif(n > 70):
print(“Grade C”)
elif(n >= 60):
print(“Grade D”)
else:
print(“Grade E”)

OUTPUT:

Enter the percentage of the number: 91

Grade A

 


Enquire Now