CLASS XII Computer Science MCQS Chapter 1 Python Revision Tour - Removed
CLASS XII Computer Science MCQS Chapter 1 Python Revision Tour - Removed
General Instructions:
a) 1 b) 1.0
c) 1.00 d) Error
4. Which of the following is an invalid variable? [1]
a) my_day_2 b) 2nd_day
c) _2 d) Day_two
5. Which two lines of code are valid strings in Python? [1]
A. This is a string
B. 'This is a string'
C. (This is a string)
D. "This is a string"
a) A, C b) B, D
c) A, D d) C, D
6. What is the value of this expression, 3*3**1? [1]
a) 3 b) 9
c) 1 d) 27
1/8
7. Which of the following is incorrect? [1]
a) sys.platform b) sys.readline
c) sys.path d) sys.argv
8. Which two operators can be used on numeric values in Python? [1]
A. @
B. %
C. +
D. #
a) B, D b) B, C
c) A, C d) A, D
9. What is the value of this expression 3**3**1? [1]
a) 3 b) 27
c) 9 d) 1
10. List AL is defined as follows: [1]
AL= [1, 2, 3, 4, 5]
Which of the following statements removes the middle element 3 from it so that the list AL
equals [1, 2, 4, 5]?
A. del a[2]
B. a[2:3] = [ ]
C. a[2:2] = [ ]
D. a[2] = [ ]
E. a.remove(3)
a) B, D, E b) A, C, D
c) C, D, E d) A, B, E
11. Which of these is not a core data type? [1]
a) Tuples b) Lists
c) Class d) Dictionary
[1]
12. def mk(x):
def mk1():
print("Decorated")
x()
return mk1
def mk2():
print("Ordinary")
p = mk(mk2)
2/8
p()
In the following code which function is the decorator?
a) mk2() b) mk1()
c) mk() d) p()
13. Which of the following is valid arithmetic operator in Python? [1]
a) < b) //
c) and d) ?
14. Which of the following cannot be a variable? [1]
a) _on b) _it
c) in d) _init_
15. Which of the following is an invalid statement? [1]
a) My Work b) mywork
c) myWORK d) MY Work
17. Which of the following expressions is an example of type casting? [1]
A. 4.0 + float(6)
B. 5.3 + 6.3
C. 5.0 + 3
D. int(3.1) + 7
a) B, C b) A, D
c) A, D d) A, C
18. Which line of code has the correct syntax for the print statement? [1]
a) | b) <<, >>
c) % d) **
20. Given the numeric variable Num1, which lines of code properly prints the value? [1]
3/8
value
a) False b) True
True True
a) 14 b) 0
c) 12 d) 27
24. Which function is more preffered for floating point number in python - sum or fsum? [1]
a) 7 b) 7.0
c) 1.0 d) 1
27. >>> float('inf') - float('inf') [1]
a) inf b) error
c) 0.0 d) nan
28. What will be the output of the following expression? [1]
24//6%3, 24//4//2, 48//3//4
4/8
c) (1, 12, #error) d) (1, 3, 4)
29. In Python we do not specify types, it is directly interpreted by the compiler, so consider the [1]
following operation to be performed.
>>> x = 33 <operator > 4
What would you fill in place of <operator> in the above expression so that x has an integer
value? Select all that apply (Python 3.xx)
A. //
B. /
C. %
D. All of these
a) A, D b) B, C
c) B, D d) A, C
30. Which of the following statements will print the following? [1]
hello-how-are-you
A. print('hello', 'how', 'are', 'you')
B. print('hello', 'how', 'are', 'you' + '-' * 4)
C. print('hello-'+ 'how-are-you')
D. print ('hello' + '-' + 'how' + '-' + 'are' + '-' + 'you')
a) B, C b) A, D
c) A, C d) C, D
31. What is the output of sys.platform [:2] if the code runs on windows operating system? [1]
a) 'wi' b) Error
c) 'op' d) 'sy'
32. What is the output of this expression, 3*1**3? [1]
a) 1 b) 27
c) 9 d) 3
33. What is the output of this code? [1]
>>> int ("3" + "4")
a) "7" b) 24
c) "34" d) 34
34. What is the output of the following expression? [1]
float(5 + int(4.39 + 2.1)%2)
a) 8 b) 8.0
c) 5 d) 5.0
35. What is the value of this expression: 22 % 3 is? [1]
a) 7.0 b) 7
c) 1.0 d) 1
5/8
36. The expression 8/4/2 will evaluate equivalent to which of the following expressions: [1]
a) (8/2)/4 b) 8/(4/2)
c) (2/4)/8 d) (8/4)/2
37. You have the following code segment: [1]
print ("Here we have a line of text \n and \n we can do \n newlines!")
What is the output of this code?
a) x^y b) x**y
c) "one" + 'two' d) 1 + 2
40. What data type is the object below? [1]
L = 1, 23, 'hello', 1
a) list b) dictionary
c) tuple d) array
41. What data type is the object below? [1]
L= [1, 23, 'hello', 1]
a) dictionary b) array
c) tuple d) list
42. Evaluate the expression given below if A = 16 and B = 15. [1]
A % B // A
a) 1.0 b) 1
c) 0 d) 0.0
43. What is the correct order of precedence in python? [1]
a) MEPDAS b) PEMDAS
c) SADMEP d) EPMDAS
44. Which of the following expressions involves coercion (implicit type promotion) when [1]
evaluated in Python?
6/8
c) 9.9 * 4.1 d) 7.1 - 3.6
45. What does 2 represents in int('1101',2)? [1]
a) class b) dictionary
c) tuple d) list
47. What is the correct operator for x to the power y in python? [1]
c) x^^y d) x^y
48. Which of the following is not a keyword? [1]
a) assert b) nonlocal
c) pass d) eval
49. What is the output of following code ? [1]
def f():
x = (2856 / 156) % 89
print(x++)
x* = 34
f()
a) 19 b) 18
c) 646 d) Error
50. Which one of these is floor division operator? [1]
a) // b) /
c) % d) none of these
51. What is the output of the following program : [1]
print Hello World [:: -1]
a) 9 b) 27
c) 1 d) 3
53. Which of the following statement prints the shown output below? [1]
hello\example\test.txt
a) print("hello"\example"\test.txt") b) print("hello\example\test.txt")
7/8
c) print("hello\"example\"test.txt") d) print("hello\\example\\test.txt")
54. Which of the following expressions results in an error? [1]
a) int('12') b) float('12.5')
c) int('12.5') d) float('12')
55. Which operator is used to check whether two variables are the same? [1]
a) = b) -
c) | d) ==
8/8