GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday, 8 November 2020

 Class 12th sumita arora solutions || Chapter 1- Python Revision tour - 1 || MCQ


1. Which of the following is an invalid variable?

(a) my_day_2
(b) 2nd_day
(c)Day_two
(d) _2

2. Which of the following is not a keyword?

(a) eval
(b) assert
(c) nonlocal
(d) pass

3. Which of the following cannot be a variable?

(a) __init__
(b) in
(c) it
(d) on

4. Which of these is not a core data type?

(a) Lists
(b) Dictionary
(c) Tuples
(d) Class

5. How would you write xy in Python as an expression?

(a) x^y
(b) x**y
(c) x^^y
(d) none of these

6. What will be the value of the expression?

14 +13 % 15

(a) 14
(b) 27
(c) 12
(d) 0

7. Evaluate the expression given below if A = 16 and B = 15.

A%B//A

(a) 0.0
(b) 0
(c) 1.0
(d) 1

8. What is the value of x?

x = int(13.25 4/2)

(a) 17
(b) 14
(c) 15
(d) 23

9. The expression 8/4/2 will evaluate equivalent to which of the following expressions:

(a) 8/(4/2)
(b) (8/4)/2

10. Which among the following list of operators has the highest precedence?

+ ,-,**,%, /,<< ,>> , |

(a) <<, >>
(b) **
(c) |
(d) %

11. Which of the following expressions results in an error?

(a) float('12')
(b) int('12')
(c) float('12.5')
(d) int('12.5')

12. Which of the following statement prints the shown output below?

hello\example\test.txt

(a) print("hello\example\test.txt")
(b) print("hello\\example\\test.txt")
(c) print("hello\"example \"test.txt")
(d) print("hello"\example"\test.txt")

13. Which value type does input() return?

(a) Boolean
(b) String
(c) Int
(d) Float

14. Which two operators can be used on numeric values in Python?

(a) @
(b) %
(c) +
(d) #

15. Which of the following four code fragments will yield following output?

Eina

Mina
Dika


Select all of the function calls that result in this output

(a)
print('''Eina
\nMina
\nDika''')

(b) print('''EinaMinaDika''')

(c) print('Eina\nMina\nDika')

(d)
print('Eina
Mina
Dika')

16. Which of the following is valid arithmetic operator in Python:

(a) //
(b) ?
(c) <
(d) and

17. The numbered position of a letter in a string is called _____.

(a) position
(b) integer position
(c) index
(d) location

18. The operator _____ tells if an element is present in a sequence or not.

(a) exists
(b) in
(c) into
(d) inside

19. The keys of a dictionary must be of _____ types.

(a) Integer
(b) mutable
(c) immutable
(d) any of these

20. Following set of commands is executed in shell, what will be the output?

>>>str = "hello"
>>>str[ : 2]
>>>


(a) he
(b) lo
(c) olleh
(d) hello

21. What data type is the object below?

L = [1, 23, 'hello', 1]

(a) list
(b) dictionary
(c) array
(d) tuple

22. What data type is the object below?

L = 1, 23, 'hello', 1

(a) list
(b) dictionary
(c) array
(d) tuple

23. To store values in terms of key and value, what core data type does Python provide?

(a) list
(b) tuple
(c) class
(d) dictionary

24. What is the value of the following expression?


3 + 3.00, 3**3.0

(a) (6.0, 27.0)
(b) (6.0, 9.00)
(c) (6, 27)
(d) [6.0, 27.0]
(e) [6, 27]

25. List AL is defined as follows:


AL = [1, 2, 3, 4, 5]

Which of the following statements removes the middle element 3 from it so that the list AL equal [1, 2, 4, 5]?

(a) del a[2]
(b) a[2 : 3] = []
(c) a[2:2] = []
(d) a[2] = []
(e) a.remove(3)

26. Which two lines of code are valid strings in Python?

(a) This is a string
(b) 'This is a string'
(c) (This is a string)
(d) "This is a string"

27. You have the following code segment:

String1 = "my"
String2 = "work"
print(String1 + string2)


What is the output of this code?

(a) my work
(b) work
(c) mywork
(d) my

28. You have the following code segment

String1 = "my"
String2 = "work"
print(String1 + string2.upper())


What is the output of this code?

(a) mywork
(b) MY Work
(c) myWORK
(d) My Work

29. Which line of code produces an error?


(a) "one" + 'two'
(b) 1+ 2
(c) "one"+ "2"
(d) '1' + 2

30. What is the output of this code?

>>> int("3" + " 4")

(a) "7"
(b) "34"
(c) 34
(d) 24

31. Which line of code will cause an error?

1. num = [5, 4, 3, [2], 1]
2. print(num [0])
3. print(num[3][0])
4. print (num[5])


(a) Line 3
(b) Line 2
(c) Line 4
(d) Line 1

32. Which is the correct form of declaration of dictionary?

(a) Day = {1 : 'Monday', 2 : 'Tuesday', 3 : 'wednesday'}
(b) Day = {1 ; 'Monday', 2 ; 'Tuesday', 3 ; 'wednesday'}
(c) Day = [1 : 'Monday', 2 : 'Tuesday', 3 : 'wednesday']
(d) Day = {1  'Monday', 2  'Tuesday', 3  'wednesday'}

33. Identify the valid declaration of L:

L = [1, 23, 'hi', 6]

(a) list
(b) dictionary
(c) array
(d) tuple

 

34. Which of the following is not considered a valid identifier in Python?

 

(a) two2

(b) _main

(c) hello_rsp1

(d) 2 hundred

 

35. What will be the output of the following code-print("100+200")?

 

(a) 300

(b) 100200

(c) 100+200

(d) 200

 

36. Which amongst the following is a mutable data type in Python?

 

(a) int

(b) string

(c) tuple

(d) list

 

37. pow() function belongs to which library?

 

(a) math

(b) string

(c) random

(d) maths

 

38. Which of the following statements converts a tuple into a list?

 

(a) len(string)

(b) list(string)

(c) tup(list)

(d) dict(string)

 

39. The statement: bval = str i > str2 shall return..... As the output if two strings str1 and str2 contains "Delhi" and "New Delhi".

 

(a) True

(b) Delhi

(c) New Delhi

(d) False

 

40. What will be the output generated by the following snippet?

 

a = [5, 10, 15, 20, 25]

k = 1

i = a[1] + 1

j = a[2] +1

m = a[k+1]

print (i, j, m)

 

(a) 11 15 16

(b) 11 16 15

(c) 11 15 15

(d) 16 11 15

 

41. The process of arranging the array elements in a specified order is termed as:

 

(a) Indexing

(b) Slicing

(c) Sorting

(d) Traversing

 

42. Which of the following Python functions is used to iterate over a sequence of number by specifying a numeric end value within its parameters?

 

(a) range()

(b) len()

(c) substring()

(d) random()

 

43. What is the output of the following?

 

d = (0: 'a', 1: 'b', 2: 'c'}

for i in d:

    print(i)

 

(a)

0

1

2

 

(b)

a

b

c

 

(c)

0

a

1

b

2

c

 

(d)

2

a

2

b

2

c

 

44. What is the output of the following?

 

x = 123

for i in x:

    print(i)

 

(a) 1 2 3

(b) 123

(c) error

(d) infinite loop

 

45. Which arithmetic operators cannot be used with strings?

 

(a) +

(b) *

(c) -

(d) all of the above

 

46. What will be the output when the following code is executed?

 

>>> str1="helloworld"

>>> stri[:-1]

 

(a) dlrowolleh

(b) hello

(c) world

(d) helloworld

 

47. What is the output of the following statement?

 

print ("xyyzxyzxzxyy".count ('yy', 1))

 

(a) 2

(b) 0

(c) 1

(d) Error

 

48. Suppose list1 [0.5 * x for x in range(0, 4)], list1 is:

 

(a) [0, 1, 2, 3]

(b) [0, 1, 2, 3, 4]

(c) [0.0, 0.5, 1.0, 1.5]

(d) [0.0, 0.5, 1.0, 1.5, 20]

 

49. Which is the correct form of declaration of dictionary?

 

(a) Day={1:'monday',2:'tuesday',3:'wednesday'}

(b) Day=(1;'monday',2;'tuesday',3;'wednesday')

(c) Day=[1:'monday',2:'tuesday',3:'wednesday']

(d) Day={1 monday',2 tuesday',3 wednesday']

 

50. Identify the valid declaration of L: L = [1, 23, 'hi', 6]

 

(a) list

(b) dictionary

(c) array

(d) tuple

 

 

 

Answer =

 

1. b

2. a

3. b

4.  d

5. b

6. b

7. b

8.  c

9. b

10. b

11. d

12. b

13. b

14. b, c

15. c

16. a

17. c

18. b

19. c

20. a

21.  a

22. d

23. d

24. a

25. a, b, e

26. b, d

27. c

28. c

29. d

30.  c

31. c

32. a

33. a

34. d

35. b

36. d

37. a

38. b

39. d

40. b

41.  c

42. a

43. a

44. c

45. c

46. a

47.  a

48. c

49. a

50. a





Credits to PATH WALA 

No comments:

Post a Comment