Assignment CBSE XI

2
1 DPS-MODERN INDIAN SCHOOL, DOHA, QATAR. Assignment (Weekly-Test - II) Class – XI (Session – 2015-16) 1. The only prompt used by the Python interactive system is the one consisting of three right- angle brackets(>>>). Justify 2. What are Escape sequence characters? Explain with examples. 3. What is the similarity and difference between break and continue statements. 4. Write the output of the following: for x in range (10): if x>7: x+=2 continue x=x+1 print “Still in the loop” if x==8: break print “Outside of the loop” 5. Write a program to print sum of even numbers series upto 10. 6. What is difference between pow() and ** ? 7. What do you mean by parameter and argument. 8. How can you create a complex literal in Python. 9. Is the statement x+1=x valid or not? Justify your answer. 10. What is the output of the following program segments? a,b,c=1,2,4 a=a+4 print(int(a/2)) 11. What will be the value of a after executing the following code? a=0 for i in range(10): a=a+1 for j in range(10): a=a+1 print(a) 12. What is the output of the following code? a=1 def f(): a=10 print a

description

Assignment CBSE XI computer

Transcript of Assignment CBSE XI

Page 1: Assignment CBSE XI

1

DPS-MODERN INDIAN SCHOOL, DOHA, QATAR.

Assignment (Weekly-Test - II)

Class – XI (Session – 2015-16) 1. The only prompt used by the Python interactive system is the one consisting of three right-

angle brackets(>>>). Justify

2. What are Escape sequence characters? Explain with examples.

3. What is the similarity and difference between break and continue statements.

4. Write the output of the following:

for x in range (10):

if x>7:

x+=2

continue

x=x+1

print “Still in the loop”

if x==8:

break

print “Outside of the loop”

5. Write a program to print sum of even numbers series upto 10.

6. What is difference between pow() and ** ?

7. What do you mean by parameter and argument.

8. How can you create a complex literal in Python.

9. Is the statement x+1=x valid or not? Justify your answer.

10. What is the output of the following program segments?

a,b,c=1,2,4

a=a+4

print(int(a/2))

11. What will be the value of a after executing the following code?

a=0

for i in range(10):

a=a+1

for j in range(10):

a=a+1

print(a)

12. What is the output of the following code?

a=1

def f():

a=10

print a

Page 2: Assignment CBSE XI

2

13. What the output will be produce by the following code:

def interest(princ, time=2, rate=0.10)

return (princ * time * rate)

print interest(6100,1)

print interest(5000, rate=0.05)

print interest(5000, 3, 0.12)

print interest(time=4, princ=5000)

14. Write a python script to generate divisors of a number.

15. Write a function that receives two numbers as an argument and display all prime numbers

between these two numbers.

16. Write a program to enter the numbers till the user wants and at the end it should display the

count of positive, negative and zeros entered.

17. Compute the natural logarithm of 2, by adding up to n terms in the series

1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1/n where n is a positive integer and input by user.

18. Write a program to reveres any given integer number

19. What are the possible outcome(s) expected from the following python code?

Also specify maximum and minimum value L can have,

import random

def main():

p = 'MY PROGRAM'

i = 0

while p[i] != 'R':

L = random.randint(0,3) + 5

print p[L],'-',

i += 1

main()

i) R - P - O - R -

ii) P - O - R - Y -

iii) O -R - A - G -

iv) A- G - R - M –

20. Write a program to enter the numbers till the user wants and at the end it should display the

maximum and minimum number entered.