Uploaded by fogeb90551

Python MCQ Question

advertisement
Career Point
Python MCQ Question Paper
Full Marks: 50 Time : 1 hr
1. What is the maximum possible length of an identifier?
a) 31 characters
b) 63 characters
c) 79 characters
d) none of the mentioned
2. Who developed the Python language?
a) Zim Den
b)Wick van Rossum
c) Guido van Rossum
d) Niene Stom
3. In which year was the Python language developed?
a) 1991
b) 1989
c) 1981
d) 1973
4. Which one of the following is the correct extension of the Python file?
a) .py
b) .python
c) .p
d) None of these
5. Which of the following is an invalid variable?
a) my_string_1
b) 1st_string
c) foo
d) _
6. Which of the following cannot be a variable?
a) __init__
b) in
c) it
d) on
7. Which is the correct operator for power(xy)?
a) X^y
b) X**y
c) X^^y
d) None of the mentioned
8. Which one of these is floor division?
a) /
b) //
c) %
d) None of the mentioned
9. What is the answer to this expression, 22 % 3 is?
a) 7
b) 0
c) 1
d) 5
10. What is the output of this expression, 3*1**3?
a) 27
b) 9
c) 3
d) 1
11. A function in Python begins with which keyword?
a) void
b) return
c) def
d) int
12. What do we use to define a block of code in Python language?
a) Key
b) Brackets
c) Indentation
d) None of these
13. Which character is used in Python to make a single line comment?
a) /
b) //
c) #
d) !
14. Which of the following declarations is incorrect?
a) _x = 2
b) ____x = 3
c) __xyz__ = 5
d) None of these
15. Which of the following words cannot be a variable in python language?
a) _val
b) val
c) try
d) _try_
16. Which of the following option is not a core data type in the python language?
a) Dictionary
b) Lists
c) Class
d) All of the above
17. Which of the following statements assigns the value 25 to the variable x in Python:
a) x ← 25
b) x = 25
c) x := 25
d) int x = 25
18. Which one of the following is the correct way of declaring and initializing a variable, x with the
value 7?
a) int x
x=7
b) int x=7
c) x=7
d) declare x=7
19. In which data type, indexing is not valid?
a) List
b)String
c) Dictionary
d) None of the above
20. Select the correct example of complex datatype in Python
a) 3 + 2j
b) -100j
c) 5j
d) All of the above are correct
21. l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?
a) List
b) Tuple
c) Set
d) None of these
22. How can we create an empty list in python?
a) list=()
b) null
c) list
d) list=[]
23. If x=3.123, then int(x) will give ?
a) 1
b) 0
c) 1
d) 3
24. Correct way to declare a variable x of float data type in python:
a) x = 2.5
b) float x = 2.5
c) float(2.5)
d) All of the above
25. In order to store values in terms of key and value we use that core data type in python?
a) List
b) Class
c) Dictionary
d) Tuple
26. Which statement is true from followinga) List is mutable & Tuple is immutable
b) List is immutable & Tuple is mutable
c) Both are Mutable.
d) Both are Immutable
27. Identify tuple from the followinga) [3]
b) {1, 2, 3}
c) (1, 2, 3, 4)
d) None of the Above
28. Special meaning words of Pythons, fixed for specific functionality are called ………. .
a) Identifiers
b) functions
c) Keywords
d) literals
29. Names given to different parts of a Python program are ………. .
a) Identifiers
b) functions
c) Keywords
d) literals
30. Data items having fixed value are called ………. .
a) Identifiers
b) functions
c) Keywords
d) literals
31. Which of the following is/are correct ways of creating strings ?
a) name = Jiya
b) name = ‘Jiya’
c) name = “Jiya”
d) name = (Jiya)
32. Which of the following are keyword(s) ?
a) name
b) Print
c) print
d) input
33. Which of the following are valid identifiers ?
a) my name
b) _myname
c) 2myname
d) my-name
34. Escape sequences are treated as ………. .
a) strings
b) characters
c) integers
d) none of these
35. Which of the following is an escape sequence for a tab character ?
a) \a
b) \t
c) \n
d) \b
36. Which of the following is an escape sequence for a newline character ?
a) \a
b) \t
c) \n
d) \b
37. Which of the following is not a legal integer type value in Python ?
a) Decimal
b) Octal
c) Hexadecimal
d) Roman
38. Which of the following value is not legal in an octal value ?
a) 7
b) 8
c) 11
d) 0
39. Which of the following is/are expression(s) ?
a) a+b-5
b) a
c) -5
d) 0
40. The lines beginning with a certain character, and which are ignored by a compiler
and not executed, are called ……….
a) operators
b) operands
c) functions
d) comments
41. Which of the following functions print the output to the console ?
a) Output( )
b) Print( )
c) Echo( )
d) print( )
42. Select the reserved keyword in Python.
a) else
b) import
c) print
d) all of these
43. The input( ) returns the value as ………. type.
a) integer
b) string
c) floating point
d) none of these
44. To convert the read value through input( ) into integer type, ……….( ) is used.
a) floating
b) float
c) int
d) integer
45. To convert the read value through input( ) into a floating point number, ……….( ) is
used.
a) floating
b) float
c) int
d) integer
46. To print a line a text without ending it with a newline, ………. argument is used with
print( )
a) sep
b) newline
c) end
d) next
47. The default separator character of print( ) is ……….
a) tab
b) space
c) newline
d) dot
48. Python is____
a) High-Level
b) Interpreted
c) Object-Oriented
d) All Of The Above
49. Which symbol denotes the python prompt?
a) >>>
b) #
c) ”’
d) //
50. Which of the following is a valid string literal?
a) “PythonMcq”
b) ‘PythonMcq’
c) ”’PythonMcq”’
d) All of these
Download