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

Introduction to Python MCQ

The document contains a series of multiple-choice questions related to Python programming, covering topics such as variable naming, data types, syntax errors, and functions. Each question is followed by the correct answer, providing a quick reference for Python concepts. It addresses aspects like case sensitivity, code execution, and the use of specific functions in Python.

Uploaded by

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

Introduction to Python MCQ

The document contains a series of multiple-choice questions related to Python programming, covering topics such as variable naming, data types, syntax errors, and functions. Each question is followed by the correct answer, providing a quick reference for Python concepts. It addresses aspects like case sensitivity, code execution, and the use of specific functions in Python.

Uploaded by

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

1. Which of the following is an invalid statement?

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

2. Which of the following is true for variable names in Python?


a) unlimited length
b) all private members must have leading and trailing underscores
c) underscore and ampersand are the only two special characters allowed
d) none of the mentioned
a) unlimited length

3. All keywords in Python are in _________


a) lower case
b) UPPER CASE
c) Capitalized
d) None of the mentioned
d) None of the mentioned

4. What is the maximum possible length of an identifier?


a) 31 characters
b) 63 characters
c) 79 characters
d) none of the mentioned
d) none of the mentioned

5. Is Python case sensitive when dealing with identifiers?


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

6. Given a function that does not return any value, What value is thrown by default when executed in
shell.
a) int
b) bool
c) void
d) None
d) None

7. What is the return type of function id?


a) int
b) float
c) bool
d) dict
a) int
8. 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
d) dictionary

9. Which of the following results in a SyntaxError?


a) ‘”Once upon a time…”, she said.’
b) “He said, ‘Yes!'”
c) ‘3\’
d) ”’That’s okay”’
c) ‘3\’

10. Which of the following is incorrect?


a) x = 30963
b) x = 0x4f5
c) x = 19023
d) x = 03964
d) x = 03964

11. Which type of Programming does Python support?


a) object-oriented programming
b) structured programming
c) functional programming
d) all of the mentioned
d) all of the mentioned

12. Which of the following is the correct extension of the Python file?
a) .python
b) .pl
c) .py
d) .p
c) .py

13. Is Python code compiled or interpreted?


a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted
a) Python code is both compiled and interpreted

14. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned
a) Indentation
15. Which of the following is the use of id() function in python?
a) Every object doesn’t have a unique id
b) Id returns the identity of the object
c) All of the mentioned
d) None of the mentioned
b) Id returns the identity of the object

16. What arithmetic operators cannot be used with strings in Python?


a) *
b) –
c) +
d) All of the mentioned
b) –

17. 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
c) Built-in function & User defined function

18. Which of the following is a Python tuple?


a) {1, 2, 3}
b) {}
c) [1, 2, 3]
d) (1, 2, 3)
d) (1, 2, 3)

19. In which language is Python written?


a)English
b)PHP
c)C
d)All of the above
c)C

20.Which of the following expressions is an example of type conversion?


(a) 4.0 + float(3)
(b) 5.3 + 6.3
(c) 5.0 + 3
(d) 3+7
(a) 4.0 + float(3)

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


(a) float(‘10’)
(b) int(‘10’)
(c) float(’10.8’)
(d) int(’10.8’)
(d) int(’10.8’)

22.What will be the output of the following Python expression? int(1011)?


(a) 1011
(b) 11
(c) 13
(d) 1101
(a) 1011

23.What will be the output of the following Python code snippet? bool(‘False’) bool()
(a) True True
(b) False True
(c) False False
(d) True False
(d) True False

You might also like