0% found this document useful (0 votes)
22 views6 pages

12th Computer Science Model Question Paper English Medium PDF Download

The document provides an overview of control structures in Python, including multiple-choice questions and detailed explanations of concepts such as if..else statements, loops, and the break statement. It includes syntax examples, programming exercises, and notes on the usage of control structures. The content is structured into parts, with questions designed to test understanding and application of Python programming principles.

Uploaded by

haritahari618
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views6 pages

12th Computer Science Model Question Paper English Medium PDF Download

The document provides an overview of control structures in Python, including multiple-choice questions and detailed explanations of concepts such as if..else statements, loops, and the break statement. It includes syntax examples, programming exercises, and notes on the usage of control structures. The content is structured into parts, with questions designed to test understanding and application of Python programming principles.

Uploaded by

haritahari618
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DINESH .

A |2019-2020

COMPUTER SCIENCE
www.Padasalai.Net www.Trb Tnpsc.com
UNIT - II
6. CONTROL STRUCTURE
Choose the best answer :
1. How many important control structures are there in Python?
A) 3 B) 4 C) 5 D) 6
2. elif can be considered to be abbreviation of
A) nested if B) if..else C) else if D) if..elif
3. What plays a vital role in Python programming?
A) Statements B) Control C) Structure D) Indentation

et
4. Which statement is generally used as a placeholder?
A) continue B) break C) pass D) goto

i.N
5. The condition in the if statement should be in the form of
A) Arithmetic or Relational expression
B) Arithmetic or Logical expression

la
C) Relational or Logical expression
D) Arithmetic sa
6. Which is the most comfortable loop?
A) do..while B) while C) for D) if..elif
da
7. What is the output of the following snippet?
i=1
while True:
Pa

if i%3 ==0:
break
print(i,end='')
w.

i +=1
A) 12 B) 123 C) 1234 D) 124
ww

8. What is the output of the following snippet?


T=1
while T:
print(True)
break
A) False B) True C) 0 D) no output
9. Which amongst this is not a jump statement ?
A) for B) goto C) continue D) break

kindly send me your key Answers to our email id - [email protected]


1|Pa g e
DINESH .A |2019-2020

www.Padasalai.Net www.Trb Tnpsc.com


10. Which punctuation should be used in the blank?
if <condition>_
statements-block 1
else:
statements-block 2
A) ; B) : C) :: D) !
Part - II
Answer the following questions (2 marks)

1. List the control structures in Python.

et
 Sequential
 Alternative or Branching

i.N
 Iterative or Looping

2. Write note on break statement.


 The break statement terminates the loop containing it. Control of the program

la
flows to the statement immediately after the body of the loop.
 When the break statement is executed, the control flow of the program comes
sa
out of the loop and starts executing the segment of code after the loop structure.

3. Write the syntax of if..else statement


da
Syntax :
if <condition>:
statements-block 1
Pa

else:
statements-block 2
w.

4. Define control structure.


 A program statement that causes a jump of control from one part of the program
to another is called control structure or control statement.
ww

5. Write note on range () in loop.


range() generates a list of values starting from start till stop-1.
range (start, stop, [step])
 start – refers to the initial value
 stop – refers to the final value
 step – refers to increment value, this is optional part.

 
kindly send me your key Answers to our email id - [email protected]
2|Pa g e
DINESH .A |2019-2020
 62 www.Padasalai.Net www.Trb Tnpsc.com
Part - III
Answer the following questions (3 marks)

1. Write a program to display


A
AB
ABC
ABCD
ABCDE

For i in range (65, 70):

et
For j in range (65, i + 1):
print (chr(j), end = ' ')

i.N
print (end='\n')
i+ = 1

la
2. Write note on if..else structure.
 When we need to construct a chain of if statement(s) then 'elif' clause can be used
instead of 'else'.
sa
 Syntax:
da
if <condition-1>:
statements-block 1
elif <condition-2>:
statements-block 2
Pa

else:
statements-block n
 In the syntax of if..elif..else mentioned above, condition-1 is tested if it is true
w.

then statements-block1 is executed, otherwise the control checks condition-2, if it


is true statements-block2 is executed and even if it fails statements-block n
mentioned in else part is executed.
ww

3. Using if..else..elif statement write a suitable program to display largest of 3


numbers.

a = int (input ("Enter number 1")


b = int (input (" Enter number 2")
c = int (input (" Enter number 3")
if a > b and a > c:
put (" A is greatest")
elif b > a and b > c:
print ("B is greatest")
else:
print ("C is greatest")

kindly send me your key Answers to our email id - [email protected]


3|Pa g e
DINESH .A |2019-2020

www.Padasalai.Net www.Trb Tnpsc.com


4. Write the syntax of while loop.
Syntax:
while <condition>:
statements block 1
[else:
statements block2]

5. List the differences between break and continue statements.


 The break statement terminates the loop containing it and control reaches after the
body of the loop where as continue statement skips the remaining part of a loop
and start with next iteration.

et
Part - IV
Answer the following questions (5 marks)

i.N
1. Write a detail note on for loop
 for loop is the most comfortable loop.

la
 It is also an entry check loop.
 The condition is checked in the beginning and the body of the loop(statements-
sa
block1) is executed if it is only True otherwise the loop is not executed.
 Syntax:
for counter_variable in sequence:
da
statements-block 1
[else: # optional block
statements-block 2]
 The counter_variable mentioned in the syntax is similar to the control variable
Pa

that we used in the for loop of C++ and the sequence refers to the initial, final and
increment value.
 The syntax of range() is as follows:
w.

range (start,stop,[step])
 start – refers to the initial value
 stop – refers to the final value
ww

 step – refers to increment value, this is optional part.


Example :
#Program to illustrate the use of for loop - to print single digit even number
for i in range (2,10,2):
print (i, end=' ')
Output :
2468

kindly send me your key Answers to our email id - [email protected]


4|Pa g e
DINESH .A |2019-2020
2. Write a detailwww.Padasalai.Net
note on if..else..elif statement with suitable example.
www.Trb Tnpsc.com
 When we need to construct a chain of if statement(s) then 'elif' clause can be
used instead of 'else'.
 Syntax :
if <condition-1>:
statements-block 1
elif <condition-2>:
statements-block 2
else:
statements-block n
 In the syntax of if..elif..else mentioned above, condition-1 is tested if it is true
then statements-block1 is executed, otherwise the control checks condition-2, if it

et
is true statements-block2 is executed and even if it fails statements-block n
mentioned in else part is executed.

i.N
la
sa
da
Pa
w.

 'elif' can be considered to be abbreviation of 'else if'.


 'elif' clause combines if..else-if..else statements to one if..elif…else.
ww

Example :
#Program to illustrate the use of nested if statement
Average Grade
>=80 and above A
>=70 and <80 B
>=60 and <70 C
>=50 and <60 D
Otherwise E
m1=int (input("Enter mark in first subject : "))

kindly send me your key Answers to our email id - [email protected]


5|Pa g e
DINESH .A |2019-2020
m2=int (input("Enter mark in second subject : "))
www.Padasalai.Net www.Trb Tnpsc.com
avg= (m1+m2)/2
if avg>=80:
print ("Grade : A")
elif avg>=70 and avg<80:
print ("Grade : B")
elif avg>=60 and avg<70:
print ("Grade : C")
elif avg>=50 and avg<60:
print ("Grade : D")
else:
print ("Grade : E")

et
Output 1:
Enter mark in first subject : 34
Enter mark in second subject : 78

i.N
Grade : D
Output 2 :
Enter mark in first subject : 67

la
3. Write a program to display all 3 digit odd numbers.
for i in range (101, 100, 2):
sa
print (i, end = " ")

4. Write a program to display multiplication table for a given number.


da
n = int (input ("Enter the number")
for i in range (1, 13):
print (n, 'x', i, " = ", n * i)
Pa

**************************ALL THE BEST************************


w.
ww

PREPARED BY
DINESH.A
THIRUVANNAMALAI
CONTACT : 9025226740

7th Unit Coming Soon….

kindly send me your key Answers to our email id - [email protected]


6|Pa g e

You might also like