SlideShare a Scribd company logo
1 of 3
Download to read offline
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

What's hot

C programming session 11
C programming session 11C programming session 11
C programming session 11
Dushmanta Nath
 

What's hot (20)

Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
Python Session - 3
Python Session - 3Python Session - 3
Python Session - 3
 
Ground Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesGround Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - Classes
 
Python interview question for students
Python interview question for studentsPython interview question for students
Python interview question for students
 
Python45 2
Python45 2Python45 2
Python45 2
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
 
Python programming msc(cs)
Python programming msc(cs)Python programming msc(cs)
Python programming msc(cs)
 
11 Unit 1 Chapter 02 Python Fundamentals
11  Unit 1 Chapter 02 Python Fundamentals11  Unit 1 Chapter 02 Python Fundamentals
11 Unit 1 Chapter 02 Python Fundamentals
 
Python revision tour i
Python revision tour iPython revision tour i
Python revision tour i
 
The Awesome Python Class Part-4
The Awesome Python Class Part-4The Awesome Python Class Part-4
The Awesome Python Class Part-4
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
 
Frequently asked tcs technical interview questions and answers
Frequently asked tcs technical interview questions and answersFrequently asked tcs technical interview questions and answers
Frequently asked tcs technical interview questions and answers
 
Python Session - 2
Python Session - 2Python Session - 2
Python Session - 2
 
C programming session 11
C programming session 11C programming session 11
C programming session 11
 
Python second ppt
Python second pptPython second ppt
Python second ppt
 
Python breakdown-workbook
Python breakdown-workbookPython breakdown-workbook
Python breakdown-workbook
 

Similar to Python Tutorial Questions part-1

Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
IruolagbePius
 
FDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on pythonFDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on python
kannikadg
 

Similar to Python Tutorial Questions part-1 (20)

Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
Python 3.pptx
Python 3.pptxPython 3.pptx
Python 3.pptx
 
Interview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfInterview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdf
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 
Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in python
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
INTERNSHIP REPORT.docx
 INTERNSHIP REPORT.docx INTERNSHIP REPORT.docx
INTERNSHIP REPORT.docx
 
Top Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdfTop Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdf
 
UNIT1Lesson 2.pptx
UNIT1Lesson 2.pptxUNIT1Lesson 2.pptx
UNIT1Lesson 2.pptx
 
Improve Your Edge on Machine Learning - Day 1.pptx
Improve Your Edge on Machine Learning - Day 1.pptxImprove Your Edge on Machine Learning - Day 1.pptx
Improve Your Edge on Machine Learning - Day 1.pptx
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
 
Python cheat-sheet
Python cheat-sheetPython cheat-sheet
Python cheat-sheet
 
FDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on pythonFDP-faculty deveopmemt program on python
FDP-faculty deveopmemt program on python
 
Python Guide.pptx
Python Guide.pptxPython Guide.pptx
Python Guide.pptx
 
Structured Languages
Structured LanguagesStructured Languages
Structured Languages
 
python ppt | Python Course In Ghaziabad | Scode Network Institute
python ppt | Python Course In Ghaziabad | Scode Network Institutepython ppt | Python Course In Ghaziabad | Scode Network Institute
python ppt | Python Course In Ghaziabad | Scode Network Institute
 
L6 - Loops.pptx
L6 - Loops.pptxL6 - Loops.pptx
L6 - Loops.pptx
 
L6 - Loops.pptx
L6 - Loops.pptxL6 - Loops.pptx
L6 - Loops.pptx
 

More from Srinimf-Slides

More from Srinimf-Slides (20)

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

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

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.