[go: up one dir, main page]

0% found this document useful (0 votes)
56 views7 pages

11th Half-Yearly Exam

Uploaded by

rajnish052006
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)
56 views7 pages

11th Half-Yearly Exam

Uploaded by

rajnish052006
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/ 7

NAV JEEVAN MISSION SCHOOL

HALF YEARLY EXAM 2022-2023


Class: XI TIME: 3 Hours
Subject: COMPUTER-PYTHON Marks: 100

SECTION – A
Multiple- Choice Questions: 12 x 1=12
1. A shortcut key to run python program is:
a) F6 b) F5 c) Ctrl + M d) Ctrl + R
2. Which of the following is a valid variable name?
a) age_entry b) 18_age c) age-entry d) @age
3. To give a tab space while printing the statement, you can use:
a) \t b) /n c) Tab key d) Spacebar
4. The input function returns _____________ value.
a) String b) Complex c) Number d) List
5. According to Boolean laws: A + A’ = ____?
a) 1 b) A c) 0 d) A’
6. Which of the following is not a Python data type?
a) String b) List c) Dictionary d) Decimal
7. Which function is used to determine the data type of an object?
a) datatype () b) type () c) dtype () d) typeofdata ()
8. Which of the following operator has the highest precedence?
a) Addition b) Multiplication c) Relational d) Exponentiation
9. range (8) is equivalent to ________.
a) range (1,8) b) range (0,8) c) range (0,8,2) d) range (1,8,1)
10. which of the following is not a Python legal string operation?
a) ‘abc’+’abc’ b) ‘abc’ * 3 c)’abc’ + 3 d)’abc’. lower ()
11. What is the role of pass statement?
A. It does nothing B. It terminates the if statement
C. It passes the control to next statement after loop D. None of the above
12. Which one of these is floor division?
a) / b) // c) % d) None of the mentioned
Fill in the blanks: 15 x 1=15

13. First index and Negative index in memory to store a string character starts with ____ and ____.
14. The ______________ operator is used to perform concatenation of two or more strings.
15. A _____________ is used as a slicing operator.
16. The ______________ bracket can be used o access characters of the string.
17. ______________ are used to indent the python code.
18. ___________ and ___________ are known as Python Jump statements.
19. The __________ statement skips the current iteration and resumes the loop from the next iteration.
20. ________________ and _______________ are three mutable data types.
21. ____________ Membership operator returns True if a character or substring exists in given string.
22. A ____________ is the smallest element in a Python program.
23. A ____________ is a name given to a memory location used by a computer program to store values.
24. Python interpreter ignores statements that start with either ________or ___________.
25. ____________are the reserved words that express a special meaning to the Python interpreter.
26. The three basic logic operators are __________, _______ and _____________.
27. The *= operator is also known as ____________.

State True or False: 8 x 1=8

28. In an expression with OR and NOT operators, the NOT operator will be executed first.

29. A value assigned to a variable once cannot be changed in a Python program.

30. Variable declaration is implicit in Python.

31. In the ‘if-else’ construct, you can place two else statements with one if.

32. You can also declare the range () function with a negative value.

33. If you remove both the indices during slicing then it will return whole string from 0 to last index.

34. Built-in function isspace () counts and returns total number of whitespaces present in the string.

35. Built-in function split () and partition () are same and return same output for same input.
SECTION – B
36. Write is the output for the following code: (5 x 2=10)
1) Str1= “Mission 999”
Str2=”999”
print (str1.isdigit(), str2.isdigit())

2)
for i in range (55,50, -2):
print(i)

3) x, y = 20, 60
y, x, y = x, y-10, x+10
print (x, y)

4) p=8.6
q=12
r=15
s=450
print(p+q)
print(p/2)
print(s//r)
print(q%5)

5)
x=1
if x>3:
if x>4:
print (“A”, end=’ ‘)
else:
print (“B”, end=’ ‘)

elif x<2:

if (x! =0):

print (“C”, end=’ ‘)

print (“D”)
37. What is the datatype of variables num_new and num_sum? (2)

num1 = 123
num2 = 1.23
num_new = num1 + num2
num3 = “456”;
num3 = int(num3)
num_sum = num1 + num3

38. Rewrite the following code using while loop. (2)

for k in range (1,15):

if k%3 = = 0:

print(k)

39. What is Dynamic typing and type casting in python? Explain with an example. (2)

40. Explain any four operators with examples. (2)

41. What will be the output of the following? (2)


(a) 87//5 (b) (87//5.0) == (87//5)
(c) 87//5.0 (d) 17%5.0

42. Rewrite the following code in Python after removing all syntax error(s). (2)
Underlined each correction done in the code.
Value =30
For VAL in range (0, Value)
If val%4==0:
print VAL*4
Elseif val%5==0:
print (VAL+3)
else
print (VAL + 10):
SECTION - C

43. Draw the Logic Circuit of the following Boolean Expression: ` (3)
(A’.C)’ + (A+ B’)’ . (B.C’)

44. Write a program to print the following pattern. (3)

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

45. Write a Program to test if a given number is prime or not. (3)

46. Suggest appropriate functions for the following tasks: (3)

a. To find for the occurrence a string within another string.

b. To convert the first letter of a string to upper case.

c. To convert string to list.

d. to check whether all letters of the string are in capital letters.

e. to remove from right of a string all string-combinations from a given set of letters

f. to remove all white spaces from the beginning of a string

(3)

47. Write a python program to receive the numbers from user through keyboard until user gives 0 (to
end the input process), then the program calculates and display the sum of given odd numbers and
even numbers respectively.
e.g. if the user gives the following sequence of numbers: 7 5 10 14 3 9 11 12
Then the output should be as follows:
The Sum of even numbers in given input sequence = 36
The Sum of odd numbers in given input sequence = 35
48. (3)
a) Which data types of Python handle Numbers?
b) What do you understand by term “immutable”?
c) What are mutable and immutable types in Python? List both of them

SECTION – D

49. Consider the following string mysubject: (5)


mySubject = "Computer Science"
What will be the output of the following string operations?
(i) print (mySubject [0: len (mySubject)])
(ii) print (mySubject [-7: -1])
(iii) print (mySubject[::2])
(iv) print(mySubject[len(mySubject)-1])
(v) print (2 * mySubject)
(vi) print(mySubject[::-2]
(vii) print (mySubject [:3] + mySubject [3:])
(viii) print (mySubject.swapcase())
(ix) print (mySubject.isalpha())
(x) print (mySubject.startswith('Comp'))

50. Explain: (5)


a) Syntax Error with example.
b) Run Time Error with example.
c) If-elif-else statement with syntax.
d) How many times does the following code execute?
C=0
while C < 20:
C+=2
e) How many times the “Hello” message will be printed by following code?
for x in range (5):
for y in range(x):
print(“Hello”)
51. Write a program that reads a line and print total number of uppercase letters, (5)

lowercase letters, alphabets, digits and symbols.

52. Write a Python program to print Fibonacci series of first 20 elements. (5)
Some initial element of Fibonacci series is: [ 0, 1, 1, 2, 3, 5, 8…]

53. Consider the following string myAddress: (5)


myAddress = "WAZ-1, New Ganga Nagar, New Delhi"
What will be the output of following string operations?
1) print (myAddress.lower())
2) print (myAddress.count('New'))
3) print (myAddress.rfind('New'))
4) print (myAddress.split(' '))
5) print (myAddress.partition(','))
6) print (myAddress.upper())
7) print (myAddress.find('New'))
8) print (myAddress.split(','))
9) print (myAddress.replace('New', 'Old'))
10) print (myAddress.index('Agra'))

You might also like