Students can read the important questions given below for Conditional And Iterative Statements Class 11 Computer Science. All Conditional And Iterative Statements Class 11 Notes and questions with solutions have been prepared based on the latest syllabus and examination guidelines issued by CBSE, NCERT and KVS. You should read all notes provided by us and Class 11 Computer Science Important Questions provided for all chapters to get better marks in examinations. Computer Science Question Bank Class 11 is available on our website for free download in PDF.
Important Questions of Conditional And Iterative Statements Class 11
Short Answer Type Questions
Question: What is the syntax of if-elif statement in Python?
Answer: The syntax of if-elif statement in python is as follows:
If condition1:
#code-block of statements when condition1 is true
elif condion2:
#code-block of statements when condition2 is true
elif condition3:
#code-block of statements when condition3 is true
.
.
.
else:
#code-block of statements when all above conditions are false.
Question: What are loops in Python? How many types of loop are there in Python?
Answer: Loops are iteration constructs in Python. Iteration means repetition of a set of statements
depending upon a condition test. Loops has three basic elements within it to repeat the statements –
- Initialization (Start)
- Check Condition (Stop)
- Updation (Step)
Python provide two types of loop - (i) Conditional Loop while( (Condition based loop)
- (ii) Counting loop for (loop for a given number of times).
Question: Rewrite the following code fragment using while loop.
Answer:
Question: What a range() function does? Give an example.
Answer: The range() function returns a sequence of numbers, starting from 0 by default, and increments
by 1 (by default), and ends at a specified number. its syntax is range(start, stop, step) e.g.
x = range(3, 6) x = range(1, 10,2)
for n in x: for n in x:
print(n) print(n)
#This code will print 3 4 5 # This code will print 1 3 5 7 9
Question: What are jump statements in Python? Name jump statements with example.
Answer: Python offers two jump statements to be used with in loops to jump out of loop-iterations.
These are break and continue statements.
Question: Rewrite the following code fragment using for loop. 5
Answer:
Skill Based Questions
Question: WAP to compute the result when two numbers and one operator is given by user.
Answer:
Question: WAP to print first n odd numbers in descending order.
Answer:
Question: WAP that searches for prime numbers from 15 through 25.
Answer:
Question: WAP to test if given number is prime or not.
Answer:
Question: WAP to input a digit and print it in words.
Answer:
Question: WAP to print the following series –
(i) 1 4 7 10 . . . . . . .40
(ii) 1 -4 7 -10 . . . . . . . . -40
Answer:
Question: WAP to find the average of the list of the numbers entered through keyboard.
Answer:
Question: WAP to check whether square root of a given number is prime or not.
Answer:
Question: WAP to calculate the roots of a given quadratic equation.
Answer:
Question: WAP to find the largest number from the list of the numbers entered through keyboard.
Answer:
Question: WAP to find the sum of first n even numbers.
Answer:
Question: WAP to print the following pattern
(a) * (b) * (c) A (d) 0
* * * * A B 2 2
* * * * * * A B C 4 4 4
* * * * * * * * A B C D 8 8 8 8
* * * * * * * * * * A B C D E
Answer:
Question: WAP to find the 2nd largest number from the list of the numbers entered through
keyboard. (This program is from List Chapter)
Answer:
Question: WAP to find the sum of n natural numbers.
Answer:
Question: WAP to find the sum of first n odd numbers.
Answer: