Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Test PYTHON 11th Revision MARKS: 15 TIME:

Q1.What will be the output of the following code snippet ? 1M

values = []
for i in range (1,4):
values.append(i)
print (values)
Q2. If you are asked to label the Python loops as determinable or non-determinable,
1M
which label would you give to which loop?
Q3. The following code is not giving desired output. We want to input value as 20
1M
and obtain output as 40. Could you pinpoint the problem?

Number = input ( "Enter Number")


DoubleTheNumber = Number * 2
Print (DoubleTheNumber)

Q4. Write a program that reads two times in military format and prints the number
2M
of hours and minutes between the two times.

Q5. What is the role of comments and indentation in a program? 2M

Q6. Define two variables first and second show that first = "jimmy" and 2M
second = "johny". Write a short python code segment that swaps the values
assigned to these two variable and print the results.

Q7. Predict the output of the following code snippet? 3M

(a)
arr = [1, 2, 3, 4, 5, 6]
for i in range(1, 6) :
arr [i - 1] = arr [i]
for i in range(0, 6) :
print(arr [ i ], end = " ")

(b)
Numbers = [ 9, 18, 27, 36 ]
for Num in Numbers :
for N in range (1,Num%8) :#% gives remainder
print (N, "#", end = " ")
print ()
Q8. What would be the output of following code if ntpl = ("Hello", "Nita", "How's",
"life?") 2M

(a, b, c, d) = ntpl
print ( "a is:", a)
print("b is:", b)
print("c is:", c)
print("d is:", d)
ntpl = (a, b, c, d)
print (ntpl[0][0]#h + ntpl[1][1]#i, ntpl[1])

Q9. What's a[1 : 1] if a is a string of at least two characters? And what if string
is shorter? 1M

You might also like