0% found this document useful (0 votes)
91 views8 pages

CLASS XII Computer Science MCQS Chapter 1 Python Revision Tour - Removed

Uploaded by

vidyuthno1
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)
91 views8 pages

CLASS XII Computer Science MCQS Chapter 1 Python Revision Tour - Removed

Uploaded by

vidyuthno1
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/ 8

CLASS 12 - COMPUTER SCIENCE

Time Allowed: 1 minute Maximum Marks: 55

General Instructions:

1. What is the most appropriate reason to use polymorphism? [1]

a) It provides a more elegant design to b) There is less code to write


program and makes it easier to
maintain and update

c) Program code takes up less space d) It makes the programmer to think at


abstract level
2. Suppose s is assigned as follows : [1]
s = 'foobar'
All of the following expressions produce the same result except one. Which one?

a) s[: : -5] b) s[0] + s[-1]

c) s[: : -1][-1] + s[len(s)-1] d) s[: : -1][: : -5]


3. What is the output of the following expression? [1]
print(4.00/(2.0 + 2.0))

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) a, b, c = 1000, 2000, 3000 b) a = b = c = 1,000,000

c) a b c = 1000 2000 3000 d) abc = 1,000,000


16. You have the following code segment: [1]
String1 = "my"
String2 = "work"
print(String1 + String2.upper())
What is the output of this code?

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) print(Its' a rainy day) b) Print('it's a rainy day')

c) print('it's\ a rainy day") d) print('it\'s a rainy day')


19. Which among the following list of operators has the highest precedence? [1]
+, -, **, %, /, <<, >>, |

a) | b) <<, >>

c) % d) **
20. Given the numeric variable Num1, which lines of code properly prints the value? [1]

a) print("%d") b) print(Num1) properly prints the

3/8
value

c) print("%d Num1") d) print("%d", Num1)


21. What is the output of following code? [1]
bool('False')
bool()

a) False b) True
True True

c) True d) Runtime Error


False
22. What is the value of the following expression? [1]
3 + 3.00, 3**3.0

a) (6.0, 27.0) b) (6.0, 9.00)

c) [6.0, 27.0] d) (6, 27)


23. What will be the value of the expression? [1]
14 + 13 % 15

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) sum b) Both have equal preference

c) There is no function fsum d) fsum


25. What will be the output produced by following code? [1]
>>> grade1 = 80
>>> grade2 = 90
>>> average1 = (grade1 + grade2)/2
>>> average2 = grade1 + grade2/2
>>> average1, average2

a) 85.0, 85.0 b) (125.0, 125.0)

c) (125.0, 85.0) d) 85.0, 125.0


26. What is the value of this expression: 22% 3.0 is? [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

a) (0, 3, 4) b) (1, 3, #error)

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) Here we have a line of text b) Here we have a line of text


and and
we can do newlines! we can do
newlines!

c) Here we have a line of text and we d) Here we have a line of text


can do newlines! and we can do newlines!

38. How would you write xy in Python as an expression? [1]

a) x^y b) x**y

c) x^^y d) none of these


39. Which line of code produces an error? [1]

a) '1' + 2 b) "one" + "2"

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?

a) 4.5 % 3 b) 5.3 + 1.8

6/8
c) 9.9 * 4.1 d) 7.1 - 3.6
45. What does 2 represents in int('1101',2)? [1]

a) The power to which the number to b) The syntax is wrong


be raised

c) The base of number d) Both the numbers are to be


converted to integer.
46. To store values in terms of key and value, what core data type does Python provide? [1]

a) class b) dictionary

c) tuple d) list
47. What is the correct operator for x to the power y in python? [1]

a) All of these b) x**y

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) Hello World b) drW olH

c) dlroW olleH d) HloWrd


52. What is the value of this expression, 3**1**3? [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

You might also like