Introduction to Python important MCQs in English/Hindi | Nielit Notes | PDF
In this post, we cover all important Questions from the topic "Introduction to Python".
These MCQs will definitely help to pass IT and Computer students in any exam and interview that have Introduction to Python topic.
The Introduction to Python chapter covers the following topics:
1. Python Introduction.
2. Technical Strength of Python.
3. Introduction to Python.
4. Interpreter and program execution, Using Comments, Literals, Constants.
5. Python’s Built-in Data types, Numbers (Integers, Floats, Complex Numbers,
Real, Sets), Strings (Slicing, Indexing, Concatenation, other operations on
Strings).
6. Accepting input from Console, printing statements.
7. Simple ‘Python’ programs.
After completion of the Introduction to Python unit, Students will be able to:
- Understand the features of Python that make it one of the most popular languages in the industry.
- Understand the structure of the Python problem.
- Understand the areas where Python is used.
Introduction to Python MCQs
Here are the 50 most important and frequently asked MCQs from the "Introduction to Python" topic.
1. State True or False: Strings are Mutable data types in python
a. True
b. False
Ans.b
2. Identify the immutable data type in python.
a. Both the mentioned
b. tuple
c. string
d. None of the Above
Ans.a
3. What data type is the object L= [1,"RAM", 20,"ECE"]
a. Tuple
b. List
c. Dictionary
d. String
Ans.b
4. Which one of the following has the same precedence
level?
a. Multiplication and addition
b. Division and Subtraction
c. Addition and Subtraction
d. Multiplication and Subtraction
Ans.c
5. Which one of the following has the highest precedence in the
expression?
a. -
b. +
c. *
d. /
Ans.c
6. Which one of the following has the lowest precedence in the expression?
a. +
b. //
c. *
d. **
Ans.a
7. Which of the following is an input statement in python
language?
a. print()
b. input()
c. get()
d. inp()
Ans.b
8. What is the output for the code type ("Hello")
a. float
b. str
c. int
d. None of the above
Ans.b
9. Python is a _____ level language, machine code is a _____ level
language
a. Low, High
b. High, Low
c. Low, Middle
d. b. High, Middle
Ans.b
10. What do we use to define a block of code in Python language?
a. Key
b. Brackets
c. Indentation
d. String
Ans.c
11. What is the output of print 0.1 + 0.2 == 0.3?
a. true
b. false
c. machine dependent
D. error
Ans.b.false
12. What is the output for the code type (3.0)
a. str
b. int
c. float
d. None of the above
Ans.c
13. Identify the correct representation for complex numbers in python?
a. (4, 3j)
b. 4+3i
c. 4+3j
d. (4+3i)
Ans.c
14. What will be the output of the following Python
code? def A(a, b =0):
c=a+b
print(c)
A(10)
a. 10
b. 20
c. 30
d. Error
Ans.a
15. What is the output for the code int (8.99)
a. 8.5
b. 9
c. 8
d. 8.99
Ans.c
16. What will be the output of the following Python
code? def A(a,b):
c=a+b
print(c)
A(10)
a. 10
b. 20
c. Error
d. 30
Ans.c
17. What is the output for the code type ("123")
a. float
b. int
c. str
d. None of the above
Ans.c
18. What is the return value of trunc()?
a. int
b. bool
c. float
D. none
Ans.a.int
19. What is the output for the code a="hello" print (a
[0:3])
a. llo
b. hell
c. hel
d. None of the above
Ans.c
20. What arithmetic operators cannot be used with strings?
a. +
b. *
c. -
d. All
Ans.c
21. Any function which calls itself again and again is a_____
a. Recursion
b. Function Composition
c. Function definition
d. None of the Above
Ans.a
22. >>>average = (grade1 + grade2) / 2
a. 85.0
b. 85.1
c. 95.0
D. 95.1
Ans.a.85.0
23. Which of the following functions is a built-in function in python
language?
a. expo()
b. add()
c. sqrt()
d. None of the above
Ans.c
24. What will be the output of the following Python
code? for i in range(2.0):
print(i)
a. 0.0 1.0
b. 0 1
c. error
d. 2.0
Ans.c
25. What will be the output of the following Python
code? x = "abcdef"
i = "a"
while i in x:
print(i)
a. i i i i i i …
b. a a a a a a …
c. a b c d e f
d. Error
Ans.b
26. What will be the output of the following Python
code? x = 'abcd'
print(x.upper())
a. Error
b. ‘ABCD’
c. ‘Abcd’
d. Error
Ans.b
27. Select the floor division
operator
a. /
b. //
c. %
d. /.
Ans.b
28. >>>example("hello")
a. indentation error
b. cannot perform mathematical operation on strings
c. hello2
d. hello2hello2
Ans.a.indentation error
29. What will be the output of the following Python
code? x = 'abcd'
print(x.lower())
a. ‘abcd’
b. ‘ABCD’
c. Error
d. ‘Abcd’
Ans.a
30. What is the output of this expression
2*1**3?
a. 3
b. 1
c. 2
d. 4
Ans.c
31. The expression float(x) implies that the variable x is converted to
float.
a. False
b. True
Ans.b
32. Identify the mutable data type in
python.
a. string
b. tuple
c. list
d. Float
Ans.c
33. What will be the output of the following Python
code? for i in range(1,10,2):
print(i)
a. 13579
b. 1357911
c. 123456789
d. Error
Ans.a
34. What will be the output of the following Python code
snippet? x = 'abcd'
for i in range(len(x)):
x = 'a'
print(x)
a. a
b. abcd abcd abcd
c. a a a a
d. None of the Above
Ans.c
35. What will be the output of the following Python
code? def A(a,b):
if a < b:
print(“Hi”)
else:
print(“Hello”)
A(10,20)
a. Hi
b. Hello
c. Error
d. 10
Ans.a
36. State True or False: Function definition executes only when function call
was made.
a. True
b. False
Ans.a
37. What is the return type of function id?
a. int
b. float
c. bool
d. dict
Ans. a.int
38. What data type is used in order to store values in terms of key and value?
a. Dictionary
b. List
c. Tuple
d. None of the above
Ans.a
39. A function is a block of code which runs only when it is called.
a. False
b. True
Ans.b
40. A file containing a set of functions in python is called as
a. Functions
b. Python File
c. Module
d. None of the above
Ans.c
41. Which of the following is not a complex number?
a. k = 2 + 3j
b. k = complex(2, 3)
c. k = 2 + 3l
D. k = 2 + 3j
Ans.c.k = 2 + 3l
42. How many keyword arguments can be passed to a function in a single
function call?
a. Zero
b. One
c. Zero or more
d. None of the above
Ans.c
43. What will be the output of the following Python
code? def foo():
total = 0
total = total + 1
return total
print(foo())
a. 0
b. 1
c. 2
d. Error
Ans.b
44. What will be the output of the following Python statement?
>>> “a”+”bc”
a. bc
b. bca
c. abc
d. adc
Ans.c
45. >>>x = 13 ? 2
a. x = 13 // 2
b. x = int(13 / 2)
c. x = 13 % 2
d. all of the mentioned
Ans.d.all of the mentioned
46. What will be the output of the following Python code?
> str =”hello”
> print(str[-1:]
a. olleh
b. o
c. h
d. ol
Ans.b
47. What will be the output of the following Python
code? for i in range(10):
if i == 5:
break
else:
print(i)
a. 0123456789
b. 012345
c. 01234
d. Error
Ans.c
48. In order to store values in terms of key and value we use what core data type.
a. list
b. tuple
c. class
d. dictionary
Ans.d.dictionary
49. What is the answer to this expression 19%5?
a. 3.9
b. 4
c. 3
d. 7
Ans.b
50. What will be the output of the following Python
code? for i in range(0,10,2):
print(i)
a. 02468
b. 2468
c. 0246810
d. Error
Ans.a
No comments: