SlideShare a Scribd company logo
2
Most read
Python Questions & Answers
Tutorial Part-1
Q.1. What is the role of keywords in Python language? List keywords provided by
Python​.
A) The Keywords in Python you can say as reserved words. All keywords are with Small
case. Only 3 keywords are not Small case. Those are True, False and None
and False nonlocal
as finally not
assert for or
break from pass
class global raise
continue if return
def import True
del in try
elif is while
else lambda with
except None yield
Q.2. What is an identifier? How will you differentiate it from a variable?
A). Identifier is an user defined variable. This can be name given to Function, Class, and
Variable by user. The length can be any length. It cannot start with numbers. And, it cannot
contain special chars.
Q.3. what is a variable? State the rules used to define a variable in Python language.
A). It is an user-defined variable. Basically it indicates a data-type. In Python, you can define
dynamically where you want. The data type it assigns dynamically according to value you
assigned to a variable. Example Char or Int
Q.4. Why documentation is necessary in a language? How documentation can be
performed in Python?
A). In Python, to make developer understand the logic, in the middle, you can write
comments. These comments start with ‘#’. This is called documentation.
Q.5. Explain the significance of data types in Python language?
A). The value you assigned to a variable defined by you, says that, that particular type applies
to that variable.
Python supports 7 data types – Number, String, List, Tuple, Set, Dictionary and File
Q.6. Identify the data type that appropriately describes the data given below:
a. 32.e10 ​➔​ Complex
b. -8.56e100 ​➔​ Float
c. 34.j ​➔​ Complex
d. -876 ​➔​ Int
e. 432 ​➔​ Int
f. 4375457L ​➔​ Long
Q.7. List all the data types provided by Python language.
int long float complex
50 3682936L 4.3 5.78j
555 -0X5789L 56.28 .863j
-897 0231L -87.32 30+29J
-1976 0XDE567AFE -56.27e10 4.24e-8j
-936 -2467896435L 71.e19 45.j
Q.8. How will you distinguish list and tuple data types?
List - is like an array a= [1,2,3,4,5,6]
Tuple - But it is immutable. That means data in a tuple is write protected. Data in a tuple is
written using parenthesis and commas
Q.9. Differentiate between set and dictionary data type in Python.
Set is an unordered collection of unique items.
a = {15, 20, 13, 45, 67}
Q.10. Explain all the data types provided by Python language with appropriate
illustrations.
Number, String, List, Tuple, Set, Dictionary and File
Example for Dictionary:
dict2 = {'name': 'Smith', 'code': 1234, 'dept':'HR'}
Dictionary is an unordered collection of key value pairs.
The file data type is used in Python to store and work with files on the computer or on
the Internet​.
Q.11. What is a slicing operator? How can you use it? Illustrate.
Python slicing is to extract part of string from your main string. This concept is called
unstring in COBOL.
Q.12. How can a user interact with the Python interpreter?
A). By typing ‘python’ on Linux, you can enter into python interpreter.
>>>
Q.13. Signify the role of input and output functions provided by Python language.
A). You can interact by using input() and print() functions. Input is to get input from user.
Print is for output.
14. How will you format the output in Python?
A). Output(), you can see many formats those you can use to display
● Print(‘ I am in output’, a)
● Print(‘I am {0} in output’.format(‘first’,’second’)
● Using format symbols
Q​.15. Elaborate the significance of import command in Python with a suitable example.
A). The import command you can use to import your’.py’ module into python interpreter.

More Related Content

PPTX
Clean code
PPTX
Python Interview questions 2020
PPTX
Intro to python
PPTX
Introduction To Programming with Python-3
PDF
Most Asked Python Interview Questions
PDF
Python interview questions
DOCX
Python interview questions
PDF
Lesson 02 python keywords and identifiers
Clean code
Python Interview questions 2020
Intro to python
Introduction To Programming with Python-3
Most Asked Python Interview Questions
Python interview questions
Python interview questions
Lesson 02 python keywords and identifiers

What's hot (20)

PDF
Data handling CBSE PYTHON CLASS 11
PPTX
Chapter 9 python fundamentals
PPTX
Python Session - 3
PPTX
Ground Gurus - Python Code Camp - Day 3 - Classes
PPTX
Python interview question for students
PDF
Python45 2
PPTX
Chapter 10 data handling
PDF
Python programming msc(cs)
PPTX
11 Unit 1 Chapter 02 Python Fundamentals
PDF
Python revision tour i
PPTX
The Awesome Python Class Part-4
PDF
Python Data Types
PPTX
Introduction To Programming with Python Lecture 2
PPT
Introduction to Python
PDF
Python revision tour II
PDF
Frequently asked tcs technical interview questions and answers
PPTX
Python Session - 2
PPS
C programming session 11
PPTX
Python second ppt
Data handling CBSE PYTHON CLASS 11
Chapter 9 python fundamentals
Python Session - 3
Ground Gurus - Python Code Camp - Day 3 - Classes
Python interview question for students
Python45 2
Chapter 10 data handling
Python programming msc(cs)
11 Unit 1 Chapter 02 Python Fundamentals
Python revision tour i
The Awesome Python Class Part-4
Python Data Types
Introduction To Programming with Python Lecture 2
Introduction to Python
Python revision tour II
Frequently asked tcs technical interview questions and answers
Python Session - 2
C programming session 11
Python second ppt
Ad

Similar to Python Tutorial Questions part-1 (20)

PDF
XII CS QUESTION BANK FOR BRIGHT STUDENTS CHAPTER WISE SET-II.pdf
PDF
class 12 computer science pdf of class e
PPTX
2. Values and Data types in Python.pptx
PPTX
Values and Data types in python
PDF
Interview-level-QA-on-Python-Programming.pdf
DOCX
Python interview questions and answers
PDF
Python interview questions and answers
PDF
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
PDF
Python Interview Questions PDF By ScholarHat.pdf
PDF
Top 80 Interview Questions on Python for Data Science | Tutort - Best Data Sc...
PPTX
L6 - Loops.pptx
PPTX
L6 - Loops.pptx
PPTX
2. Getting Started with Python second lesson .pptx
PDF
Introduction to phyton , important topic
PPTX
L5 - Data Types, Keywords.pptx
PPT
Python - Module 1.ppt
PDF
GE3151 UNIT II Study material .pdf
PPTX
Chapter 1 Python Revision (1).pptx the royal ac acemy
PPTX
parts_of_python_programming_language.pptx
PPTX
Python variables and data types.pptx
XII CS QUESTION BANK FOR BRIGHT STUDENTS CHAPTER WISE SET-II.pdf
class 12 computer science pdf of class e
2. Values and Data types in Python.pptx
Values and Data types in python
Interview-level-QA-on-Python-Programming.pdf
Python interview questions and answers
Python interview questions and answers
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
Python Interview Questions PDF By ScholarHat.pdf
Top 80 Interview Questions on Python for Data Science | Tutort - Best Data Sc...
L6 - Loops.pptx
L6 - Loops.pptx
2. Getting Started with Python second lesson .pptx
Introduction to phyton , important topic
L5 - Data Types, Keywords.pptx
Python - Module 1.ppt
GE3151 UNIT II Study material .pdf
Chapter 1 Python Revision (1).pptx the royal ac acemy
parts_of_python_programming_language.pptx
Python variables and data types.pptx
Ad

More from Srinimf-Slides (20)

PPTX
software-life-cycle.pptx
PPT
Cics testing and debugging-session 7
PPT
CICS error and exception handling-recovery and restart-session 6
PPT
Cics program, interval and task control commands-session 5
PPT
Cics data access-session 4
PPT
CICS basic mapping support - session 3
PPT
Cics application programming - session 2
PPT
CICS basics overview session-1
PPTX
100 sql queries
PDF
The best Teradata RDBMS introduction a quick refresher
PDF
The best ETL questions in a nut shell
PDF
IMS DC Self Study Complete Tutorial
PPT
How To Master PACBASE For Mainframe In Only Seven Days
PPT
Assembler Language Tutorial for Mainframe Programmers
PPT
The Easytrieve Presention by Srinimf
PPTX
Writing command macro in stratus cobol
PPT
PLI Presentation for Mainframe Programmers
PPTX
PL/SQL Interview Questions
PPTX
Macro teradata
PPTX
DB2-SQL Part-2
software-life-cycle.pptx
Cics testing and debugging-session 7
CICS error and exception handling-recovery and restart-session 6
Cics program, interval and task control commands-session 5
Cics data access-session 4
CICS basic mapping support - session 3
Cics application programming - session 2
CICS basics overview session-1
100 sql queries
The best Teradata RDBMS introduction a quick refresher
The best ETL questions in a nut shell
IMS DC Self Study Complete Tutorial
How To Master PACBASE For Mainframe In Only Seven Days
Assembler Language Tutorial for Mainframe Programmers
The Easytrieve Presention by Srinimf
Writing command macro in stratus cobol
PLI Presentation for Mainframe Programmers
PL/SQL Interview Questions
Macro teradata
DB2-SQL Part-2

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Machine learning based COVID-19 study performance prediction
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
KodekX | Application Modernization Development
PDF
Electronic commerce courselecture one. Pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
Machine learning based COVID-19 study performance prediction
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
KodekX | Application Modernization Development
Electronic commerce courselecture one. Pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...

Python Tutorial Questions part-1

  • 1. Python Questions & Answers Tutorial Part-1 Q.1. What is the role of keywords in Python language? List keywords provided by Python​. A) The Keywords in Python you can say as reserved words. All keywords are with Small case. Only 3 keywords are not Small case. Those are True, False and None and False nonlocal as finally not assert for or break from pass class global raise continue if return def import True del in try elif is while else lambda with except None yield Q.2. What is an identifier? How will you differentiate it from a variable? A). Identifier is an user defined variable. This can be name given to Function, Class, and Variable by user. The length can be any length. It cannot start with numbers. And, it cannot contain special chars. Q.3. what is a variable? State the rules used to define a variable in Python language. A). It is an user-defined variable. Basically it indicates a data-type. In Python, you can define dynamically where you want. The data type it assigns dynamically according to value you assigned to a variable. Example Char or Int
  • 2. Q.4. Why documentation is necessary in a language? How documentation can be performed in Python? A). In Python, to make developer understand the logic, in the middle, you can write comments. These comments start with ‘#’. This is called documentation. Q.5. Explain the significance of data types in Python language? A). The value you assigned to a variable defined by you, says that, that particular type applies to that variable. Python supports 7 data types – Number, String, List, Tuple, Set, Dictionary and File Q.6. Identify the data type that appropriately describes the data given below: a. 32.e10 ​➔​ Complex b. -8.56e100 ​➔​ Float c. 34.j ​➔​ Complex d. -876 ​➔​ Int e. 432 ​➔​ Int f. 4375457L ​➔​ Long Q.7. List all the data types provided by Python language. int long float complex 50 3682936L 4.3 5.78j 555 -0X5789L 56.28 .863j -897 0231L -87.32 30+29J -1976 0XDE567AFE -56.27e10 4.24e-8j -936 -2467896435L 71.e19 45.j Q.8. How will you distinguish list and tuple data types? List - is like an array a= [1,2,3,4,5,6] Tuple - But it is immutable. That means data in a tuple is write protected. Data in a tuple is written using parenthesis and commas Q.9. Differentiate between set and dictionary data type in Python. Set is an unordered collection of unique items. a = {15, 20, 13, 45, 67}
  • 3. Q.10. Explain all the data types provided by Python language with appropriate illustrations. Number, String, List, Tuple, Set, Dictionary and File Example for Dictionary: dict2 = {'name': 'Smith', 'code': 1234, 'dept':'HR'} Dictionary is an unordered collection of key value pairs. The file data type is used in Python to store and work with files on the computer or on the Internet​. Q.11. What is a slicing operator? How can you use it? Illustrate. Python slicing is to extract part of string from your main string. This concept is called unstring in COBOL. Q.12. How can a user interact with the Python interpreter? A). By typing ‘python’ on Linux, you can enter into python interpreter. >>> Q.13. Signify the role of input and output functions provided by Python language. A). You can interact by using input() and print() functions. Input is to get input from user. Print is for output. 14. How will you format the output in Python? A). Output(), you can see many formats those you can use to display ● Print(‘ I am in output’, a) ● Print(‘I am {0} in output’.format(‘first’,’second’) ● Using format symbols Q​.15. Elaborate the significance of import command in Python with a suitable example. A). The import command you can use to import your’.py’ module into python interpreter.