Go to your University || Python Lab || DSA Lab || AI & Machine Learning Lab || Linux Lab || OOPs Lab || DBMS Lab || JAVA Lab

0 like 0 dislike
27 views

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.8k points)
selected by
 
Best answer

Q10.  Explain how can you make a Python Script executable on UNIX?

Ans.  To make a Python Script executable on UNIX, you need to do two things

  • Script file's mode must be executable and

  • the first line must begin with # ( #!/usr/local/bin/python)

Q11.  Explain how can you access a module written in Python from C?

Ans.  You can access a module written in Python from C by following method,

Module = =PyImport_ImportModule("<modulename>");

Q12.   Mention the use of // operator in Python?

Ans.   It is a Floor Division operator, which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance, 

10//5 = 2 and 10.0//5.0 = 2.0.

Q13.  What does this mean: *args, **kwargs? And why would we use it?

AnsWe use *args when we aren’t sure how many arguments are going to be passed to a function, or if we want to pass a stored list or tuple of arguments . to a function. **kwargs is used when we don’t know how many keyword arguments will be passed to a function, or it can be used to pass the values .   of a dictionary as keyword arguments. The identifiers args and kwargs are a convention, you could also use *bob and **billy but that would not be, wise.

Q14.  What is the Difference between Python 3 and Python 2 ?

Ans.  

Python2

Python3

It is more stable and transparent version of python programming language.

It is future of Python designed to address the design flawn in the previous versions.

The print syntax is treated as a statement rather than a function that requires text to be wrapped in parenthesis. 

The print is explicitly treated as a function and replaced by the print() function in Python 3 which requires an extra pair of parenthesis.

ASCII string type is used by default to store strings.

Unicode is the implicit string type by default.

It simply returns an integer to the nearest whole number when dividing two integers.

It makes integer division more intuitive by using true division for integers and floats.

xrange function reconstructs the sequence every time.

xrange is replaced by range() function in Python 3.

Q15.  What is Enumerate() Function in Python?

Ans.   The Python enumerate() function adds a counter to an iterable object. enumerate() function can accept sequential indexes starting from zero.

Related questions

0 like 0 dislike
1 answer 18 views
asked Oct 7, 2019 in Tutorial & Interview questions by Goeduhub Goeduhub's Expert (7.8k points)
0 like 0 dislike
2 answers 27 views
asked Feb 7 in Tutorial & Interview questions by Goeduhub Goeduhub's Expert (7.8k points)
 Placements:   List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Online Free Training:  MACHINE LEARNINGPython Programming | Database Management System(DBMS) | Object Oriented Programming(OOPs) using C++ | Data Structures and Algorithms(DSA) | Java Programming | Linux/Unix | C Programming
Exams: List of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG) | JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Goeduhub
About Us | Contact Us   Social::   |  | 

 

...