0% found this document useful (0 votes)
9 views

Unit II MCQ -Python

The document consists of a series of questions and answers related to Python programming concepts, including case sensitivity, function definitions, comments, operators, and data types. Key topics covered include the use of built-in functions, order of precedence, and the characteristics of different data types. Each question is followed by the correct answer, providing a quick reference for Python programming knowledge.

Uploaded by

kaleeswaranmmcas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Unit II MCQ -Python

The document consists of a series of questions and answers related to Python programming concepts, including case sensitivity, function definitions, comments, operators, and data types. Key topics covered include the use of built-in functions, order of precedence, and the characteristics of different data types. Each question is followed by the correct answer, providing a quick reference for Python programming knowledge.

Uploaded by

kaleeswaranmmcas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. Is Python case sensitive when dealing with identifiers?

a) no
b) yes
c) machine dependent
d) none of the mentioned

Answer: b
2. Which keyword is used for function in Python language?
a) Function
b) def
c) Fun
d) Define

Answer: b
3. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

Answer: b
4. 15. What will be the output of the following Python code snippet if x=1?
x<<2
a) 4
b) 2
c) 1
d) 8

Answer: a
5. What is the order of precedence in python?
a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Addition, Division, Subtraction
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

Answer: d
6. Which of the following functions is a built-in function in python?
a) factorial()
b) print()
c) seed()
d) sqrt()

Answer: b
7. What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
a) -4
b) -3
c) 2
d) False

Answer: d
Explanation: The function max() is being used to find the maximum value from
among -3, -4 and false. Since false amounts to the value zero, hence we are left with
min(0, 2, 7) Hence the output is 0 (false).
8. Which of the following is not a core data type in Python programming?
a) Tuples
b) Lists
c) Class
d) Dictionary

Answer: c
9. Which of the following statements is used to create an empty set in Python?
a) ( )
b) [ ]
c) { }
d) set()

Answer: d
10. What is the maximum possible length of an identifier in Python?
a) 79 characters
b) 31 characters
c) 63 characters
d) none of the mentioned

Answer: d
11. What are the two main types of functions in Python?
a) System function
b) Custom function
c) Built-in function & User defined function
d) User function

Answer: c
12. Which of the following is a Python tuple?
a) {1, 2, 3}
b) {}
c) [1, 2, 3]
d) (1, 2, 3)

Answer: d
13. What will be the output of the following Python expression?
round(4.576)
a) 4
b) 4.6
c) 5
d) 4.5
Answer: c
14. What is output of print(math.pow(3, 2))?
a) 9.0
b) None
c) 9
d) None of the mentioned

Answer: a
15. Which one of these is floor division?
a) /
b) //
c) %
d) None of the mentioned

Answer: b

16. Operators with the same precedence are evaluated in which manner?
a) Left to Right
b) Right to Left
c) Can’t say
d) None of the mentioned

Answer: a
17. What is the output of this expression, 3*1**3?
a) 27
b) 9
c) 3
d) 1

Answer: c
18. What will be the output of the following Python code?

1.>>>str="hello"
2.>>>str[:2]
3.>>>

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

Answer: a

19. What data type is the object below?

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


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

Answer: a

20. Which of the following will run without errors?


a) round(45.8)
b) round(6352.898,2,5)
c) round()
d) round(7463.123,2,1)

Answer: a

You might also like