Quiz on Python Extensions
Extension is an important topic that can save a lot of time for a developer. With the help of Python extensions, we can very easily use any other language’s code in python. This can save us from writing redundant code.
The following quiz contains questions covering python extensions. Let’s start!!!
0 of 15 Questions completed Questions: You have already completed the quiz before. Hence you can not start it again. Quiz is loading… You must sign in or sign up to start the quiz. You must first complete the following: 0 of 15 Questions answered correctly Your time: Time has elapsed You have reached 0 of 0 point(s), (0) Earned Point(s): 0 of 0, (0) def addTwoOperands(op1, op2): return op1 + op2 Which of the following C implementation will provide the same functionality: Code C type #include <Python.h> static PyObject* sampleFunc(PyObject* self) { return Py_BuildValue(“s”, “Hello Quizorbit”); } static PyMethodDef Sample_funcs[] = { {“sampleFunction “, (PyCFunction)sampleFunc, METH_NOARGS, “sample function” }, {NULL} }; static PyObject *module_ func(PyObject *self, PyObject *args) { int op1; int op2; if (!PyArg_ParseTuple(args, “ii”, &op1, &op2)) { return NULL; } int temp= op1; op1= op2; op2 = temp; return Py_BuildValue(“i”, op1 – op2); } static PyObject *module_ func(PyObject *self, PyObject *args) { int op1; int op2; if (!PyArg_ParseTuple(args, “ii”, &op1, &op2)) { return NULL; } int temp= op1; op1= op2; op2 = temp; return Py_BuildValue(“i”, op1 – op2); } static PyObject *module_ func(PyObject *self, PyObject *args) { int op1; int op2; if (!PyArg_ParseTuple(args, “ii”, &op1, &op2)) { return NULL; } int temp= op1; op1= op2; op2 = temp; return Py_BuildValue(“i”, op1 – op2); } static PyObject *module_ func(PyObject *self, PyObject *args) { int op1; int op2; if (!PyArg_ParseTuple(args, “ii”, &op1, &op2)) { return NULL; } int temp= op1; op1= op2; op2 = temp; return Py_BuildValue(“i”, op1 – op2); } Quiz Summary
Information
Results
Results
0 Essay(s) Pending (Possible Point(s): 0) Categories
1. Question
2. Question
3. Question
4. Question
5. Question
6. Question
7. Question
8. Question
9. Question
10. Question
11. Question
12. Question
13. Question
14. Question
15. Question
Summary
Redundancy is the cause of many problems and extensions are one of the important solutions to this. Now that you are well versed with python extensions, do check out other interesting quizzes on Quiz Orbit.
worrest &bad compling