St. Britto Hr. Sec. School - Madurai
12th Computer Science Monthly Test - 1 ( Control Structures )-Aug 2020
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Write the syntax of alternative method to write complete if-else.
-
Write a program to check if the year is leap year or not.
-
What is the use of continue statement in python?
-
What are the values taken by range ()?
-
Write a program to check if a number is Positive, Negative or zero.
-
List the control structures in Python.
-
Write a program to check if the given number is a palindrome or not.
-
# Program to check the age and print whether eligible for voting
x=int (input("Enter your age :"))
if x>=18:
print ("You are eligible for voting") -
Write a python program to find the sum of even numbers between 1 and 10.
-
Write a program to display sum of natural numbers, upto n.
-
What is meant by alternative or branching?
-
Write a program to display Fibonacci series 0 1 1 2 3 4 5........(up to n terms)
-
What is the expression or statement at ?1? and ?2? in the following program to get the output
2 4 6 8
for?1? in range (2, ?2?, 2):
print (i, end = ") -
Write the program to print the following pattern
* * * * *
* * * *
* * *
* *
* -
Write the syntax of working of continue statement in for and while loop.
-
Why we need to construct the pass statement?
-
program to illustrate the use of string in range() of for loop
for word in 'Computer':
print (word,end=' ')
else:
print ("\nEnd of the loop") -
What will be the range of values displayed by the following?
-
#program to illustrate the use of for loop - to print single digit even number with else part
for i in range(2,10,2):
print (i,end=' ')
else:
print ("\nEnd of the loop") -
Write the syntax of while loop.
-
-
Write note on if..else structure.
-
Using if..else..elif statement write a suitable program to display largest of 3 numbers.
-
-
Write a python program to print all numbers from 10 to 15 using while loop.
-
Examples for range()
range (1,30,1) will start the range of values from 1 and end at 29 range (2,30,2) will start the range of values from 2 and end at 28 range (30,3,-3) - will start the range of values from 30 and end at 6
range (20) will consider this value 20 as the end value(or upper limit) and starts the range count from 0 to 19 (remember always range() will work till stop -1 value only -
Write note on if..else structure.
-
-
Write a program in python to display he following output
1
2 2
3 3 3
4 4 4 4 5 5 5 5 5 -
Program to illustrate the use of pass statement
a=int (input(“Enter any number :”))
if (a==0):
pass
else:
print (“non zero value is accepted”)
-
-
Program to illustrate the use of pass statement in for loop
for val in “Computer”:
pass
print (“End of the loop, loop structure will be built in future”) -
Write a program in python to display the following output.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5 -
Write a detail note on if..else..elif statement with suitable example.
-
Program to illustrate the use of continue statement inside for loop
for word in “Jump Statement”:
if word = = “e”:
continue
print (word, end=”)
print (“\n End of the program”)