Is python a case sensitive language?
Yes! Python is a case sensitive programming language.
What are the supported data types in Python?
Python has five standard data types −
Numbers
String
List
Tuple
Dictionary
What Programming Paradigm does Python supports?
Python supports both Procedural Programming approach as well as Object Oriented Programming Approach. Moreover, you can use both the approaches in a single Python program.
How to take input from the User in Python?
Python provides a built-in method to accept input from the user.
It is as follows: input(“Enter the Input”)
However, in order to store the input in a variable, you must write a variable name before the input() method.
It can done as follows: var1=input(“Enter the input”)
What is the output of print str * 2 if str = ‘Hello World!’?
It will print string two times. Output would be Hello World!Hello World!.
What is the output of print str + “TEST” if str = ‘Hello World!’?
It will print concatenated string. Output would be Hello World!TEST.
How to terminate a line of code in Python?
Python is an extremely efficient and easy to use language. You can terminate a Python line of code using a Semi-Colon. However, it is not mandatory to use a Semi-colon at the end of every line. It is up to you if you want to use it or not.
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
How does global value mutation used for thread-safety?
The global interpreter lock allows the running of the thread one at a time. This is used to distribute the functionality among all the virtual machines that are used. Python allows the switching between the threads to be performed by using the byte code instructions to provide platform-independence. The sys.setcheckinterval() method is used to allow the switching to occur during the implementation of the program and the instruction. This provides the understanding in the field of accounting to use the byte code implementation that makes it portable to use. The atomicity can be provided such that the shared variables can be given as built-in data types.
Write a program to read and write the binary data using python?
The module which is used to write and read the binary data is known as struct. This module allows many functionalities to be used that consist of the string class. This class contains the binary data that is in the form of numbers that gets converted in python objects for use and vice versa. The program can read or write the binary data is:
import struct
f = open(file-name, "rb")
# This Open() method allows the file to get opened in binary mode to make it portable for # use.
s = f.read(8)
x, y, z = struct.unpack(">hhl", s)
The ‘>” is used to show the format string that allows the string to be converted in big-endian data form. For homogenous list of data the array module can be used that will allow the data to be kept in more organized fashion.
What is the output of print tuple[1:3] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?
It will print elements starting from 2nd till 3rd. Output would be (786, 2.23).
What is the output of print tuple[2:] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?
It will print elements starting from 3rd element. Output would be (2.23, ‘john’, 70.200000000000003).
What is the purpose of // operator?
// Floor Division − The division of operands where the result is the quotient in which the digits after the decimal point are removed.
What is the purpose of is operator?
is − Evaluates to true if the variables on either side of the operator point to the same object and false otherwise. x is y, here is results in 1 if id(x) equals id(y).
Yes! Python is a case sensitive programming language.
What are the supported data types in Python?
Python has five standard data types −
Numbers
String
List
Tuple
Dictionary
What Programming Paradigm does Python supports?
Python supports both Procedural Programming approach as well as Object Oriented Programming Approach. Moreover, you can use both the approaches in a single Python program.
How to take input from the User in Python?
Python provides a built-in method to accept input from the user.
It is as follows: input(“Enter the Input”)
However, in order to store the input in a variable, you must write a variable name before the input() method.
It can done as follows: var1=input(“Enter the input”)
CA Technologies Python Recent Asked Interview Questions Answers |
What is the output of print str * 2 if str = ‘Hello World!’?
It will print string two times. Output would be Hello World!Hello World!.
What is the output of print str + “TEST” if str = ‘Hello World!’?
It will print concatenated string. Output would be Hello World!TEST.
How to terminate a line of code in Python?
Python is an extremely efficient and easy to use language. You can terminate a Python line of code using a Semi-Colon. However, it is not mandatory to use a Semi-colon at the end of every line. It is up to you if you want to use it or not.
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
How does global value mutation used for thread-safety?
The global interpreter lock allows the running of the thread one at a time. This is used to distribute the functionality among all the virtual machines that are used. Python allows the switching between the threads to be performed by using the byte code instructions to provide platform-independence. The sys.setcheckinterval() method is used to allow the switching to occur during the implementation of the program and the instruction. This provides the understanding in the field of accounting to use the byte code implementation that makes it portable to use. The atomicity can be provided such that the shared variables can be given as built-in data types.
Write a program to read and write the binary data using python?
The module which is used to write and read the binary data is known as struct. This module allows many functionalities to be used that consist of the string class. This class contains the binary data that is in the form of numbers that gets converted in python objects for use and vice versa. The program can read or write the binary data is:
import struct
f = open(file-name, "rb")
# This Open() method allows the file to get opened in binary mode to make it portable for # use.
s = f.read(8)
x, y, z = struct.unpack(">hhl", s)
The ‘>” is used to show the format string that allows the string to be converted in big-endian data form. For homogenous list of data the array module can be used that will allow the data to be kept in more organized fashion.
What is the output of print tuple[1:3] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?
It will print elements starting from 2nd till 3rd. Output would be (786, 2.23).
What is the output of print tuple[2:] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?
It will print elements starting from 3rd element. Output would be (2.23, ‘john’, 70.200000000000003).
What is the purpose of // operator?
// Floor Division − The division of operands where the result is the quotient in which the digits after the decimal point are removed.
What is the purpose of is operator?
is − Evaluates to true if the variables on either side of the operator point to the same object and false otherwise. x is y, here is results in 1 if id(x) equals id(y).
Post a Comment