Xi CS Revision Exam MS
Xi CS Revision Exam MS
Xi CS Revision Exam MS
13 What will be the output for the following statement when executed in python shell?
>>> print((not False and True) > (True and False) or int(10/20))
a) True b) False c) None d) Error
16 Choose the correct option to convert the following string value to integer and store it in
variable y.
x="78.96"
a. y=int(float(x)) b. y=int(eval(x)) c. y=int(x) d. a or b
17 What is the output of the following code?
print(complex())
a. 0j b. 0+0j c. 0 d. Error
18 A = 2.0
B = “2”
C = “2.2”
Which of the following will return the result as floating point number ?
a) A + float(B) b) B + C c) A + C d) float(C) + B
19 Which jump statement in python terminates the loop?
a) continue b) break c) exit d) return
20 Which of the following is not a python functions type:
A. Module function
B. User-defined function
C. Random function
D. Built-in-function
21 What is the output of "hello" +str(123+321)?
A. hello123321
B. hello444
C. Error
D. hello132231
22 Which of the following is a selection control statement:
A. print
B. if…else
C. for
D. while
23 The following is displayed by a print function call:
tom
dick
harry
Select all of the function calls that result in this output
a) print(”’tom
\ndick
\nharry”’)
b) print(”’tomdickharry”’)
c) print(‘tom\ndick\nharry’)
d) print(‘tom
dick
harry’)
24 What is the output of the following?
i=5
while True:
if i%0O11 == 0:
break
print(i)
i += 1
a) 5 6 7 8 9 10
b) 5 6 7 8
c) 5 6
d) error
Section-B
This section consists of 24 Questions (26 to 49). Attempt any 20 questions from this section.
Choose the best possible option.
26 DE Morgan’s law states that
a) (AB)’ = A’ + B’
b) (A + B)’ = A’ * B
c) A’ + B’ = A’B’
d) (AB)’ = A’ + B
27 Which gate returns true if both inputs are similar otherwise false.
a) NAND
b) NOR
c) XOR
d) None of the above
28 The expression for Absorption law is given by _________
a) A + AB = B
b) AB + AA’ = A
c) A + AB = A
d) A + B = B + A
29 The boolean function A + BC is a reduced form of ____________
a) AB + BC
b) (A + B)(A + C)
c) A’B + AB’C
d) (A + C)B
30 A variable on its own or in its complemented form is known as a __________
a) Product Term
b) Literal
c) Sum Term
d) Word
31 Derive the Boolean expression for the logic circuit shown below:-
a) CA + CB + CD
b) C(A+B)D’
c) C(A+B) + D
d) CA+CB+D
32 The truth table for the expression AB + B’C has how many input combinations?
a) 1 b) 2 c) 4 d)8
33 Consider the following code and choose the correct output:-
a,b,c=4,5,6
a,b,c=c+2,a,b
t=a,b,c
print(t)
a) 8 8 5 b) 8 8 6 c) 8 , 6, 8 d) 8 4 5
34 Which of the following is not an immutable type in Python?
(a) String
(b) Tuple
(c) Set
(d) Dictionary
35 Consider the following sequence of statements:
a = 35
m=a
Following the execution of these statements, Python has created how many objects and how
many references ?
(a) Two integer objects, two references
(b) One integer object, two references
(c) One integer object, one reference
(d) Two integer objects, one reference
36 For two objects x and y, the expression x is y will yield True, if and only if
(a) id(x) = id(y)
(b) len(x) == len(y)
(c) x == y
(d) all of these
37 Identify statement(s) which will produce 10 odd numbers:
a. for x in range(1,19,2):
b. for x in range(1,20,2):
c. for x in range(19, 1, -2):
d. for x in range(19,-1,-2):
38 Each individual character in a string can be accessed using a technique called ____________
a. Indexing
b. Replication
c. Concatenation
d. None of the above
39 What type of error is returned by statement :
>>> str[1.5]
a. SyntaxError
b. ValueError
c. IndexError
d. TypeError
40 What is the minimum and maximum value that guessnum can take? If N is 20
import random
N = int(input("enter a number :"))
guessnum = random.randrange(N-10)+10
print(guessnum)
a) 10, 19 b) 10, 20 c) 0, 10 d) 0, 9
41 What will the output of the following code
n=4
for i in range(n):
for j in range(i):
print ( j , end=" ")
print(‘\n ')
a) 1 b) 1 c) 1 d) None
1 2 2 3 2 2
1 2 3 4 5 6 3 3 3
42 In Python, a variable is assigned a value of one type, and then later assigned a value of
different type. This will yield _____.
(a) Warning
(b) Error
(c) None
(d) No Error
43 Which of the following literals has False truth-value ?
a. 3 b. 4 c. 0 d. Infinite
46 Which of the following is correct slicing operation to extract every kth character from the
string str1 starting from n and ending at m-1.
a. str1[: : k]
b. str1[n : m+1 : k]
c. str1[n : m : k ]
d. str1[m : n : k ]
Section-C
This section consists of 6 Questions (50 to 55). Attempt any 5
#String functions
st = “A#B#C#D#E”
print(st.split(“#”,2)) # statement 1
print(st.replace(“#”,”?”)) # statement 2
print(“I love my Country”.find(“o”,4)) # statement 3
print(‘#’.join(“12345”)) # statement 4
print(“abbzabzazabb”.count(“bb”,1)) # statement 5
print(“ i love my Country”.title()) #statement 6
**********************