0% found this document useful (0 votes)
15 views4 pages

Python Programming Concepts and Exercises

The document contains a series of questions and exercises related to Python programming concepts for Grade 11 Computer Science students. It covers topics such as keywords, output predictions for code snippets, identifier rules, control structures, and string functions. Additionally, it includes programming tasks for students to implement various algorithms.
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)
15 views4 pages

Python Programming Concepts and Exercises

The document contains a series of questions and exercises related to Python programming concepts for Grade 11 Computer Science students. It covers topics such as keywords, output predictions for code snippets, identifier rules, control structures, and string functions. Additionally, it includes programming tasks for students to implement various algorithms.
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

Grtade 11 Computer Science

Answer the following


1. State True or False: “Python has a set of keywords that can also be used to declare
variables
2. What will be the output of the following statement: print ((30.0 // 4 + (8 + 3.0))
a. 14.75 b. 18.0 c. -18.0 d. Error
3. Select the correct output of the following python code:
str="My program is program for you"
t = [Link]("program")
print(t)
a) ('My ', 'program', ' is ', 'program', ' for you') b) ('My ', 'program', ' is program for you')
c) ('My ', ' is program for you') d) ('My ', ' is ', ' for you').
4. Consider the statements given below and then choose the correct output from the given
options:
MN="Bharat @G20"
print(MN[-2:2:-2])
a. rt@2 b. 2@tr c. @G20 d. 02G@
5. Which of the following statement(s) would give an error after executing the following
code?
S="Welcome to velammal vidhyashram" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '$' # Statement 4
S=S+"Thank you" # Statement 5
(a) Statement 3 (b) Statement 4 (c) Statement 5 (d) Statement 4 and 5
6. What possible outputs(s) will be obtained when the following code is executed?
import random
Signal=['Stop','Wait','Go']
for K in range (2,0,-1):
R=[Link](K)
print(Signal[R], end='#') .
a. Stop#Go# b. Wait#Stop# c. Go#Stop# d. Go#Wait#
7. State True or False: “In a Python program, if a break statement is given in a nested loop, it
terminates the execution of all loops in one go.”
8. What will be the output of the following code snippet?
str= “ Prevention is better than cure"
print(str[-2::-2])
9. Identify the output of the following code snippet:
text = "COMPUTERSCIENCE2025"
text=[Link]('E','#')
print(text)
(A) COMP#T#R#SC#I#NCE (B) COMP##TR#SCI##N#C#
(C) COMPUT#RSCI#NC# (D) COMPU#T#SC#IC##
10. State True or False. “Identifiers are names used to identify a variable, function in a
program”
11. Select the correct output of the code:
s = "church#arch"
print([Link]("ch"))
(a) urch#ar (b)ur#ar (c) church#ar (d)urch#arch
12. Identify the valid Python identifier from the following:
(a)2user (b) user@2 (c) user_2 (d)user 2
13. Which of the following output will never obtained when the given code is executed? (1)
import random
league=[Link](10)+1
knock=10*[Link](5)
print(“league”, league, end=”**”)
print(“knock”, knock)
(a) league 1 ** knock 0 (b) league 10 ** knock 10
(c) league 10 ** knock 0 (d) league 11 ** knock 50
Answer the following
1. Difference between Type Promotion and Type casting with example
2. List the naming rules for identifiers
3. What is the common structure of Python compound statements?
4. What is empty statement in Python? What is its need?
5. What are the different control structures in Python?
6. What is entry-controlled loop?
7. What are the four elements of a while loop in Python?
8. In which cases, the else clause of a loop does not get executed?
9. What is the difference between else clause of if-else and else clause of Python loops?
10. What are jump statements? Name them and explain
11. What are endless loops ? Why do such loops occur?
12. How is break statement different from continue?
13. Explain forward and backward indexing
14. What are mutable and immutable datatypes with example
15. Explain precedence of operators with an example
Complete the given mind maps
Operators
String
functions

Character search and starts and converting word by


Trimming Partitioning
check replace end checks characters word split

String
functions

returns a returns returns a


returns string returns a list Operators
boolean value integer tuple

Write the functions along with its usage

Modules

math statistics random


Errors

Runtime
Syntax Logical
errors

Predict the output of the given code snippets


s="Olympic Games" a = int(input("Enter an integer: "))
n = len(s) b = int(input("Enter an integer: "))
m="" if a <= 0:
for i in range (0, n) : b = b +1
if (s[i] >= 'a' and s[i] <= 'm') : else:
m = m + s [i].upper() a=a+1
elif (s[i] >= 'O' and s[i] <= 'z') : if a > 0 and b > 0:
m = m +s [i-1] print ("W")
elif (s[i].isupper()): elif a > 0:
m = m + s[i].lower() print("X")
else: if b > 0:
m = m + '@' print("Y")
print (m) else:
print("Z")
What letters will be printed if the user enters
0 for a and 0 for b ?
x=3 a=0
if x == 0: for i in range(4,8):
print ("Am I here?", end = ' ') if i % 2 == 0:
elif x == 3: a=a+i
print("Or here?", end = ' ') print (a)
else : j = 10
pass while j >= 5:
print ("Or over here?") print("X")
j=j-1
Write Python program for the following
1. To calculate SI 2. To check whether the given number is prime or not 3. To check
whether the given year is leap year or not 4. To check whether the given number is an
Armstrong number 5. To check whether the given string is palindrome or not 6. To count the
no of words in the given string 7. To count the no of upper case, lower case, vowels,
consonants, digits and special characters in the given string
8. To print the Fibonacci series for the given no of terms 9. To print the greatest and smallest
of 3 numbers 10. To get a string and print the reverse of the string word by word
(e.g) I love teaching I evol gnihcaet

You might also like