How will you remove last object from a list?
list.pop(obj=list[-1]) − Removes and returns last object or obj from list.
How will you remove an object from a list?
list.remove(obj) − Removes object obj from list.
How will you reverse a list?
list.reverse() − Reverses objects of list in place.
How will you sort a list?
list.sort([func]) − Sorts objects of list, use compare func if given.
Q97).Name five modules that are included in python by default (many people come searching for this, so I included some more examples of modules which are often used)
datetime (used to manipulate date and time)
re (regular expressions)
urllib, urllib2 (handles many HTTP things)
string (a collection of different groups of strings for example all lower_case letters etc)
itertools (permutations, combinations and other useful iterables)
ctypes (from python docs: create and manipulate C data types in Python)
email (from python docs: A package for parsing, handling, and generating email messages)
__future__ (Record of incompatible language changes. like division operator is different and much better when imported from __future__)
sqlite3 (handles database of SQLite type)
unittest (from python docs: Python unit testing framework, based on Erich Gamma’s JUnit and Kent Beck’s Smalltalk testing framework)
xml (xml support)
logging (defines logger classes. enables python to log details on severity level basis)
os (operating system support)
pickle (similar to json. can put any data structure to external files)
subprocess (from docs: This module allows you to spawn processes, connect to their input/output/error pipes, and obtain their return codes)
webbrowser (from docs: Interfaces for launching and remotely controlling Web browsers.)
traceback (Extract, format and print Python stack traces)
Name a module that is not included in python by default
mechanize
django
gtk
A lot of other can be found at pypi.
What is __init__.py used for?
It declares that the given directory is a package. #Python Docs (From Endophage‘s comment).
Enlist Popular Frameworks of Python?
Major Frameworks: Django and Pyramid
Minor Frameworks: Bottle and Flask
What is Lambda in Python specification?
It is a single expression which is an Anonymous Method often used as Inline function.
Enlist the Applications of Python Programming?
1. Web Application Development and Web Frameworks such as DJango and Pyramid.
2. Game Development
3. Desktop Based Applications
4. Micro Frameworks such as Bottle and Flask
What is the grid() method used for in Python?
grid() method is the one that all the widgets in a Python GUI Program’s frame have. It’s associated with a layout manager, which lets you arrange widgets in a Frame.
Is Python a Scripting Language or not?
Python is a General-Purpose Programming Language or rather a Multi-Purpose Programming Language. It is also a Scripting Language as it can be used to combine it into HTML Code used for Web Development.
Explain modes in Python Programming Environment?
Script Mode: This mode is used to compile and save Python programs which is not possible in the Interactive mode.
Interactive Mode: This mode can be thought of as a scratchpad to check out codes in Python Environment.
In order to make it executable, we should prefer Script Mode.
What is Slicing in Python?
Slicing is a terminology hat is used to generate sliced or modified output from Lists and Tuples.
Enlist commonly used Classes in games Module in livewires Package?
The commonly used Classes in Games Module under Livewires Package are as follows:
Text
Screen
Sprite
Message
What is the difference between Print(“Hello World”) and print(“Hello World”)?
Python Programming Language is Case-Sensitive. So, Print(“Hello World”) would give an error as the syntax is not correct. However, print(“Hello World”) would work perfectly.
How do you create a RadioButton Element in Python?
The RadioButton Class is available in Tkinter Module. We first need to import it and then we can take in a frame label by the following command:
radiobutton1 = Radiobutton(frame1, text= “C Programming”, value=0)
radiobutton1.grid()
radiobutton1 is a variable to hold the Radio Button Element and frame1 is the the name of the Frame variable onto to which we want to adjust our Radio Button. The default value of a Radio Button is 1 which means ‘Selected’. We need to set it to value=0.
Enlist a difference between Tuples and Lists.
Tuples and Lists are used to store a sequence of data within them. A difference between them is that Tuples once defined cannot be altered under any circumstances whereas Lists can be altered.
list.pop(obj=list[-1]) − Removes and returns last object or obj from list.
How will you remove an object from a list?
list.remove(obj) − Removes object obj from list.
How will you reverse a list?
list.reverse() − Reverses objects of list in place.
Capita Plc Most Frequently Asked Python Latest Interview Questions Answers |
How will you sort a list?
list.sort([func]) − Sorts objects of list, use compare func if given.
Q97).Name five modules that are included in python by default (many people come searching for this, so I included some more examples of modules which are often used)
datetime (used to manipulate date and time)
re (regular expressions)
urllib, urllib2 (handles many HTTP things)
string (a collection of different groups of strings for example all lower_case letters etc)
itertools (permutations, combinations and other useful iterables)
ctypes (from python docs: create and manipulate C data types in Python)
email (from python docs: A package for parsing, handling, and generating email messages)
__future__ (Record of incompatible language changes. like division operator is different and much better when imported from __future__)
sqlite3 (handles database of SQLite type)
unittest (from python docs: Python unit testing framework, based on Erich Gamma’s JUnit and Kent Beck’s Smalltalk testing framework)
xml (xml support)
logging (defines logger classes. enables python to log details on severity level basis)
os (operating system support)
pickle (similar to json. can put any data structure to external files)
subprocess (from docs: This module allows you to spawn processes, connect to their input/output/error pipes, and obtain their return codes)
webbrowser (from docs: Interfaces for launching and remotely controlling Web browsers.)
traceback (Extract, format and print Python stack traces)
Name a module that is not included in python by default
mechanize
django
gtk
A lot of other can be found at pypi.
What is __init__.py used for?
It declares that the given directory is a package. #Python Docs (From Endophage‘s comment).
Enlist Popular Frameworks of Python?
Major Frameworks: Django and Pyramid
Minor Frameworks: Bottle and Flask
What is Lambda in Python specification?
It is a single expression which is an Anonymous Method often used as Inline function.
Enlist the Applications of Python Programming?
1. Web Application Development and Web Frameworks such as DJango and Pyramid.
2. Game Development
3. Desktop Based Applications
4. Micro Frameworks such as Bottle and Flask
What is the grid() method used for in Python?
grid() method is the one that all the widgets in a Python GUI Program’s frame have. It’s associated with a layout manager, which lets you arrange widgets in a Frame.
Is Python a Scripting Language or not?
Python is a General-Purpose Programming Language or rather a Multi-Purpose Programming Language. It is also a Scripting Language as it can be used to combine it into HTML Code used for Web Development.
Explain modes in Python Programming Environment?
Script Mode: This mode is used to compile and save Python programs which is not possible in the Interactive mode.
Interactive Mode: This mode can be thought of as a scratchpad to check out codes in Python Environment.
In order to make it executable, we should prefer Script Mode.
What is Slicing in Python?
Slicing is a terminology hat is used to generate sliced or modified output from Lists and Tuples.
Enlist commonly used Classes in games Module in livewires Package?
The commonly used Classes in Games Module under Livewires Package are as follows:
Text
Screen
Sprite
Message
What is the difference between Print(“Hello World”) and print(“Hello World”)?
Python Programming Language is Case-Sensitive. So, Print(“Hello World”) would give an error as the syntax is not correct. However, print(“Hello World”) would work perfectly.
How do you create a RadioButton Element in Python?
The RadioButton Class is available in Tkinter Module. We first need to import it and then we can take in a frame label by the following command:
radiobutton1 = Radiobutton(frame1, text= “C Programming”, value=0)
radiobutton1.grid()
radiobutton1 is a variable to hold the Radio Button Element and frame1 is the the name of the Frame variable onto to which we want to adjust our Radio Button. The default value of a Radio Button is 1 which means ‘Selected’. We need to set it to value=0.
Enlist a difference between Tuples and Lists.
Tuples and Lists are used to store a sequence of data within them. A difference between them is that Tuples once defined cannot be altered under any circumstances whereas Lists can be altered.
What is the difference between a Lambda and Def?
A Def is a function that can contain multiple expressions whereas a Lambda can contain only one single expression. A Def method can contain return statements whereas a Lambda cannot contain return statements. A Lambda can be used inside lists and dictionaries.
A Def is a function that can contain multiple expressions whereas a Lambda can contain only one single expression. A Def method can contain return statements whereas a Lambda cannot contain return statements. A Lambda can be used inside lists and dictionaries.
Post a Comment