TN Board 12th Computer Science Important Questions Chapter 14 Importing C++ Programs in Python

TN State Board 12th Computer Science Important Questions Chapter 14 Importing C++ Programs in Python

Question 1.
What is a script language?
Answer:
A script language is a programming language for integrating and communicating with other programming language.

Question 2.
Write some of the most widely used script language?
Answer:
JavaScript, VBScript, PHP, Perl, Python, Ruby, ASP AND TCI.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 3.
What is called Garbage collection?
Answer:

  1. Python deletes unwanted objects (built- in types or class instances) automatically to free the memory space.
  2. The process by which python periodically frees and reclaims blocks of memory that no longer are in use is called Garbage collection.

Question 4.
What is a g++?
Answer:
g++ is a program that calls GCC (GNU C Compiler) and automatically links the required C++ library files to the object code.

Question 5.
What is the use ‘+’ in os.system ()?
Answer:
‘+’ in os.system ( ) indicates that all strings are concatenated as a single string and send that as a List.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 6.
What purpose of using GNUC compiler?
Answer:
g++ is a program that calls GCC (GNUC Compiler) and automatically links the required C++ library files to the object code.

Question 7.
What is a command for wrapping C++ code?
Answer:
if _name_ = = ‘_main_’:
main (Sys. argv [1:])

Question 8.
Write the syntax of os.system ( ).
Answer:
The syntax of os.system ( ) is
os.system (‘g++’ + <variable_namel>
‘ – <mode>’ + <variable_name 2>)

Question 9.
Write the syntax of getopt ( ).
Answer:
The syntax of getopt ( ) is
<opts>, <args> = getopt. getopt (argv, options, [long_options])

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 10.
Differentiate static and dynamic language.
Answer:

Static  Dynamic
A static typed language like C++ requires the programmer to explicitly tell the computer what data type, each data value is going to use.  A dynamic typed language like python does not require the data type to be given explicitly for the data. Python manipulate the variable based on the type of value.

Question 11.
Write the steps to executing C++ program through python.
Answer:

  1. Double click the run terminal of MinGW.
  2. Go to the folder where the python software is located, For example Python is folder is located in.
  3. c:\program files\open office 4\python

Question 12.
Write the modular program in python to find factorial of given number.
Answer:
def fact (n):
f= 1
if n == 0:
return 0
elif n = 1:
return 1
else :
for i in range (1, n+1):
f=f*i
print (f)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 13.
Write a note on main (sys.argv [1]).
Answer:

  1. main (sys.argvfl]) – Accepts the python program and input file (C++ file) as a list (array).
  2. argv [0] contains the python program which is need not to be passed because by default _main_ contains source code reference
  3. argv [1] contains the name of the C++ file which is to be processed.

Question 14.
What are the commonly used interfaces when importing C++ files in python?
Answer:

  1. Python-C-API: (API-Application Programming Interface for interfacing with C programs)
  2. Ctypes (for interfacing with c programs)
  3. SWIG (Simplified Wrapper Interface Generator- Both G and C++)
  4. Cython (Cython is both a Python-like language for writing C-extensions)
  5. Boost.Python (a framework for interfacing Python and C++)
  6. MinGW (Minimalist GNU for Windows)

Question 15.
Write the syntax of os,system ()? Explain the arguments.
Answer:
The os module allows you to interface with the windows operating system where python is running on.
The syntax is
os.system (‘g++’ + <variable__namel> ‘-<mode>’ + <variable_name2>
Where
os.system – function system (defined in os module).
g++ – General compiler to compile C++ program under windows operating system.
Variable_name1 – Name of the C++ file without 1 extension.cpp in string format.
mode – To specify input or output mode. Here it is ‘mode’ prefixed with hyphen.
Variable_name2 – Name 0f the executable file without extension.exe in string format.
Eg:
os.system (‘g++’ + cpp_file + ‘-o’ + exe_file)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 16.
Write a C++ program to print Transpose of matrix (2D array). And save the file as transpose.py. Program that compile and execute in python.
Answer:
//Now select File→New in Notepad and type the C++ program.
#include <iostream>
using namespace std
int main( )
{
int a[3][3], i, j;
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
cout<<“enter the value for array[“<<i+1 <<”]”<<“[“<<j+1<<”] :”;
cin>>a[i][j];
}
}
system(“cls”);
cout<<“\n\nOriginal Array\n”;
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
cout<,a[i][j]<<‘
cout<<endl;
}
cout<<“\n\n The Transpose of Matrix\n”;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
cout<<a[j][i]<<‘ ‘;
cout<<endl;
}
return 0;
}
import sys, os, getopt
def main(argv):
cppjile = “
exefile – ”
opts, args – getopt.getopt(argv, “i:”,[‘ifile=’])
for o, a in opts:
if o in (“-i”, ifile”):
cpp_file = a+‘.cpp’
exe_file – a + ‘.exe’
run(cpp_file, exe_file)
def run(cpp_file, exe_file):
print(“Compiling ” + eppfile)
os.system(‘g++ ’ + cpp_file + ‘ -o ’ + exe_ file)
print(“Running ” + exefile)
print(“———-”)
print
os.system(exe_file)
print
if_name_main
main(sys.argv[l:])

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 17.
Write a C++ program containing functions and executing by python program.
Answer:
/*Write a C++ program using a user defined function to function cube of a number.*/

//Now select File—>New in Notepad and type the C++ program
#//include <iostream>
using namespace std;
// Function declaration
int cube(int num);
int main()
{
int num;
int c;
cout<<”Enter any number: “<<endl;
cin>>num;
c = cube(num);
Cout<<”Cube of “ <<num<< “ is “<<c;
return 0;
}
//Function to find cube of any number
int cube(int num)
{
return (num * num * num);
}

// Save this file as cubefile.cpp
#Now select File → New in Notepad and
type the Python program
# Save the File as fun.py
# Program that compiles and executes a .cpp file
# Python fun.py -i c:\pyprg\cube_file.cpp
import sys, os, getopt
def main(argv):
cpp_file =’ ‘
exe_file =‘ ’
opts, args – getopt.getopt(argv, “i:”,[‘ifile=’])
for o, a in opts:
if o in (“-i”, ifile”):
cpp_file = a + ‘.cpp’
exe_file = a + ‘.exe’
run(cpp_file, exe file)
def run(cpp_file, exe_file):
print(“Compiling “ + cppfile)
os.system(‘g++ ‘ + cpp_file + ‘ -o ‘ + exe_ file)
print(“Running “ + exe file)
print(“———-”)
print
os.system(exe_file)
print
if_name_==_main_’:
main(sys.argv[l:])
Output of the above program
Compiling e:\pyprg\cube_file.cpp
Running c:\pyprg\cube_file.exe
——————-
Enter any number:
5
Cube of 5 is 125

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 18.
Write a C++ program to implement multilevel inheritance of a class and executing by python program.
Answer:
// C++ program to implement Multilevel Inheritance
//Now select File—>New in Notepad and type the C++program
//include <iostream>
using namespace std;
#base class
class Vehicle
{
public:
Vehicle( )
{
cout<< “This is a Vehicle” <<endl;
}
};
class threeWheeler: public Vehicle
{public:
three Wheeler( )
{
cout<<”Objects with 3 wheels are vehicies”<<endl;
}
};
// sub class derived from two base classes
class Auto: public threeWheeler{
public:
Auto( )
{
cout<<”Auto has 3 Wheels”«endl;
}
};
// main function int main( )
{
//creating object of sub class will invoke the constructor of base classes
Auto obj;
return 0;
}
// Save this file as inheri cpp.cpp
//Now select File → New in Notepad and type the Python program
# Save the File as classpy.py
# Python classpy.py -i inheri_cpp command to execute C++ program
import sys, os, getopt
def main (argv):
cpp_file = ‘ ’
exe_file = ‘ ’
opts, args = getopt.getopt (argv, “i:”,[‘ifile=’])
for o, a in opts:
if o in (“-i”, “-ifile”):
cpp_ file = a + ‘.cpp’
exe_file = a + ‘.exe’
run (cpp_file, exefile)
def run(cpp_file, exe file):
print (“Compiling “ + cpp_file)
os.system (‘g++ ‘ + cpp_file + ‘ -o ‘ + exe_ file)
print (“Running “ + exe_file)
print (“————-”)
print
os.system (exe_file) print
if_name_==’_main_’:
main (sys.argv[1:])
Output of the above program
Compiling c:\pyprg\class_file.cpp
Running c:\pyprg\class_file.exe
—————-
This is a Vehicle
Objects with 3 wheels are vehicles
Auto has 3 Wheels

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 19.
What is the theoretical difference between Scripting language and other programming language?
Answer:

Scripting language

 Other languages (Programming language)

A script language requires an interpreters.  Programming language requires a compiler.
A script language do not require the compilation step and are rather interpreted.  But programming languages needs to be compiled before running.
Example: Javascript, python etc.,  Example: C++, COBOL etc.,

Question 20.
Differentiate compiler and interpreter.
Answer:

Compiler

 Interpreter

Compile the entire program and translates it as a whole machine code.  Interpreter translates program one statement at a time.
It takes large amount of time to analyze the source code but execution time is faster.  It takes less amount of time to analyze the source code, and execution time is slower.
Example for C, C++ use compilers.  Example for python, Javascript use interpreters.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 21.
Write the expansion of
(i) SWIG
(ii) MinGW
Answer:
(i) SWIG – Simplified Wrapper Interface Generation.
(ii) MinGW – Minimalist GNU for windows.

Question 22.
What is the use of modules?
Answer:

  1. We use modules to breakdown large programs into small manageable and organized files.
  2. Modules provides reusability of code.
  3. We can define our most used functions in a module and import it, instead of copying their definitions into different programs.

Question 23.
What is the use of cd command. Give an example.
Answer:
In python use cd command Hold Shift + Right click in explorer in the folder where the python file is will create a proper path string for your OS.
Eg. Using cd command in python
>>>import OS
>>>OS.system (“cd c:\mydir”)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 24.
Differentiate PYTHON and C++.
Answer:

PYTHON

 C++

Python is typically an “interpreted” language.  C++ is typically a “compiled” language.
Python is a dynamic typed language.  C++ is compiled statically typed language.
Data type is not required while declaring variable.  Data type is required while declaring variable.
It can act both as scripting and general purpose language.  It is a general purpose language.

Question 25.
What are the applications of scripting language?
Answer:
Applications of scripting Languages:

  1. To automate certain tasks in a program.
  2. Extracting information from a data set.
  3.  Less code intensive as compared to traditional programming language..
  4. Can bring new functions to applications and give complex systems together.

Question 26.
What is MinGW? What is its use?
Answer:

  1. MinGW – (Minimalist GNU for windows), it refers to a set of runtime header files, used in compiling and linking the code of C,C++ and FORTRAN to be run on windows operating system.
  2. It uses to compile and execute the C++ program.
  3. MinGW allows to compile execute the C++ program dynamically through python program using g++.
  4. MinGW – W64 is the best compiler for C++ on windows.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 27.
Identify the module, operator, definition name for the following weleome.display ( )
Answer:
Welcome.display ( )
welcome – module
Dot – Dot operator
display ( ) – Function name

Question 28.
What is sys.argv? What does it contain?
Answer:

  1. sys.argv is the list of command – line arguments passes to the python program.
  2. argv contains all the items that come along via the command-line input, It’s basically an array holding the command-line arguments of the program.
  3. The first argument, sys.argv[0], is always the name of the program as it was invoked, and sys.argv [1] is the first argument you pass to the program.

Question 29.
Write any 5 features of Python.
Answer:
Features of Python over C++:

  1. Python uses Automatic Garbage Collection whereas C++ does not.
  2. C++ is a statically typed language, while Python is a dynamically typed language.
  3.  Python runs through an interpreter, while C++ is pre-compiled.
  4. Python code tends to be 5 to 10 times shorter than that written in C++.
  5. In Python, there is no need to declare types explicitly where as it should be done in C++.
  6. In Python, a function may accept an argument of any type, and return multiple values without any kind of declaration beforehand. Whereas in C++ return statement can return only one value.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 30.
Explain each word of the following command.
Answer:
Python <filename.py> -<i> <C++ filename
without cpp extension>

  1. Python – Keyword to execute the python program from command-line.
  2. filename.py – Name of the python program to executed.
  3. -i – input mode
  4. C++ filename without cpp extension- name of C++ file to be compiled and executed.

Question 31.
What is the purpose of sys,os,getopt module in Python.Explain.
Answer:
(i) sys module:
This module provides access to
some variables used by the interpreter and to functions that interact strongly with the interpreter, sys.argv is the list of command-line argument passed to the python program.

(ii) OS module:
The OS module in python provides a way of using operating system dependent functionality, os.system ( ) – execute the C++ compiling command in the shell.

(iii) get opt module:
The getopt module of python helps you to parse (split) command-line options and arguments.
getopt.getopt method parses command¬’ line options and parameter list.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 32.
Write the syntax for getopt( ) and explain its arguments and return values.
Answer:
The getopt module of python helps you to parse command-line options and arguments.
The syntax is
<opts>,<args> = getopt.getopt (argv, options, [long-options])
Where,
argv- This is the argument list of values to be parsed (splited).
In our program the complete command will be passed as a list.

Options:
This is string of options letters that the python program recognize as for input or for output with options (T or ‘0’) that follower by a colon (:).
Here colon is used to denote the mode.
long-options. This parameter is passed with a list of strings.
Argument of long options should be followed ^ by an equal sign (‘=’).
getopt( ) method returns value consisting of two elements.
Each of these values are stored separately in two different list (arrays) opts and orgs.
Eg:
opts, args = getopt.getopt (argv,”i:”, [‘ifile=’]) Where
opts – [(‘-i’, ‘c:\\pyprg\\p4’)
‘c:\\pyprg\\p4’ – Value, absolute path.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 33.
Write a Python program to execute the following C++ coding.
Answer:
#include <iostream>
using namespace std;
int main( )
{
cout<<“WELCOME”;
return(0);
}
The above C++ program is saved in a file welcome.cpp
import sys, Os, get opt
def main (argv)
cpp_file = 11
exe_file =11
opts, args = etopt.getopt(argv, “i:”, [‘i file=’] for 0, a in (“-1”, “ i file”):
if 0, in opts:
cpp_file = a + ‘.cpp’
exe_file = a + ‘.exe’
run(cpp_file, exe_file)
def run (cpp file, exe file):
print(“compiling”+cpp_file)
Os.system (‘g++’ +cpp file + ‘ – 0’ + exe_file)
print (“Running” + exefile)
print
Os.system (exe file)
print
if_name_== ‘_main_’: main (sys.argv[l:])

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 34.
Write a C++ program to create a class called Student with the following details.
Answer:
Protected member
Rno integer
Public members
void Readno(int); to accept roll number and assign to Rno
void Writeno( ); To display Rno.
The class Test is derived Publically from the Student class contains the following details.

Protected member
Mark1 float
Mark2 float
Public members
void Readmark(float, float); To accept mark1 and mark2
void Writemark( ); To display the marks
Create a class called Sports with the following detail

Protected members
score integer
Public members
void Readscore(int); To accept the score
void Writescore( ); To display the score
The class Result is derived Publically from Test and Sports class contains the following details

Private member
Total float
Public member
void display( ) assign the sum of mark1, mark2, score in total.
invokeWriteno( ), Writemark( ) and
Writescore( ). Display the total also.
Save the C++ program in a file called hybrid.
Write a python program to execute the hybrid.cpp
# include <io stream.h>
# include <conil.h>
class student
{
private:
char name [30];
int Rno;
Float mark1, mark2, Total_marks;
protected;
void Readmark ( )
{
cout <<“\n Type name, Roll no, markl, mark2”;
cin>>Rno>>Name>>mark1>>mark2;
}
void writescore ( )
{
Total marks = mark1 + mark2;
}
void writemark ( )
{ .
cout <<“\n Name” <<name;
cout <<“\n Roll No” <<Rno;
cout <<“\n Mark 1” <<mark1;
cout <<“\n Mark 2” <<mark2;
cout <<“\n Total_marks” <<Total_marks;
}
public:
student ( )
{
name [0] = ‘\o’;
Rno = mark1 = mark2 = totalmarks 0;
}
void execute ( );
{
Read mark ( );
Write score ( );
Write mark ( );
}
};
void main ( )
{
clrscr ();
student stud;
stud.execute ();
}
// save This file as hyprid.cpp
// Write python program to execute hyprid.Answer:
cpp in python
import sys, os, getopt
def main (argv):
cpp_file = “
exe_file = ”
opts, args = getopt.getopt(argv, “i:”,[ifile =])
for o, hyprid in opts:
if o in (“-i”, “–file”):
cpp_file = hyprid + ‘.cpp’
exe_file = hyprid + ‘.exe’
run (cpp_file, exe_file)
def run (cpp_file, exe_file):
os.system(‘g++’ + cpp_file + ‘-o’ + exe_file)
os.system (exe_file)
print
if name = ‘_main_’:
main (sys.argv [1:])

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 35.
Write a C++ program to print boundary elements of a matrix and name the file as Border.cpp
Answer:
// C++ program to print boundary element
// ot.matrix
# include <bits/studc++.h>
Using namespace std;
Const int MAX = 100;
void print Boundary (int a [ ][MAX],
int m, int n
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j<n; j++)
{
if (i ==0 || j == 0|| i == n – 1 || j == n – 1)
cout <<a[i] [j] << “ ”;
else
cout<<“ ”
<<“ ”;
}
cout <<“\n”;
}
}
int main ( )
{
int a [4] [MAX] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {1,2, 3, 4}, {5,6, 7, 8}};
return 0; }
// To save this C++ program as Border.cpp

Write a python program to Border.cpp
import sys, os, getopt
def main (argv):
cPP_file=“
exe_file =”
opts, args = getopt.getopt (argv, for O, Border in opts:
if 0 in (‘-1”, “- -file”):
cpp-file = Border + ‘.cpp’
exe-file = Border + ‘.exe’
run cpp_file, exe_file)
def run (cpp_file, exe_file):
os.system (“g++” + cpp_file + ‘-0’ + exe_file)
os.system (exe_file)
if_name_ == ‘_main_’:
main (sys.argv [1:])

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Choose the best answer:

Question 1.
Python is mostly used as a …………… language.
(a) High level
(b) Scripting
(c) glue
(d) B or C
Answer:
(d) B or C

Question 2.
What is the name called, python deletes unwanted objects automatically to free the memory space?
(a) Recycle
(b) Garbage collection
(c) Interface
(d) Wrapping
Answer:
(b) Garbage collection

Question 3.
Which mode is specify to input or output in python?
(a) ‘-o’
(b) ‘-i’
(c) ‘-a’
(d) ‘-s’
Answer:
(a) ‘-o

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 4.
Which method is used to returns values ‘ consisting of two values?
(a) append ( )
(b) extend ( )
(c) getopt ( )
(d) insert ( )
Answer:
(c) getopt ( )

Question 5.
Which interface is used for python-like language for writing c-extensions?
(a) Cython
(b) Boost
(c) SWIG
(d) MinGW
Answer:
(a) Cython

Question 6.
Match the following:

(i) Python  A. for windows
(ii) C++  B. wrapper interface
(iii) SWIG  C. dynamic language
(iv) MinGW  D. Statical language

(a) (i) – C, (ii) – D, (iii) – B, (iv) – A
(b) (i) – C, (ii) – B, (iii) – A, (iv) – D
(c) (i) – B, (ii) – A, (iii) – D, (iv) – C
(d) (i) – D, (ii) – A, (iii) – C, (iv) – B
Answer:
(a) (i) – C, (ii) – D, (iii) – B, (iv) – A

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 7.
Choose the incorrect pair:

Column – I  Column – II
(a) Python  interpreted
(b) C++  Compiled
(c) TCI  High level language
(d) ASP  Script language

Answer:
(c)

Question 8.
Choose the correct pair:

Column – I  Column – II
(a) stud.py  module
(b) sys.argv  getopt module
(c) os.system  sys module
(d) getopt  A variable

Answer:
(a)

Question 9.
Choose the incorrect statement.
(a) Python is typically a compiled language.
(b) Python is a dynamic typed language.
(c) In python, Data type is not required while declaring variable.
(d) Python is a script and general purpose language.
Answer:
(a) Python is typically a compiled language.

Question 10.
Choose the correct statement.
(a) Sys module provides access to variable used by the compiler.
(b) sys.argv is the list of command-line arguments passed to the python program,
(c) Python has no standard (Built in) modules.
(d) Module does not provide reusability of code.
Answer:
(b) sys.argv is the list of command-line arguments passed to the python program

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 11.
Assertion (A):
Python is actually an interpreter, high level, general-purpose programming language.
Reason (R):
It can be used for processing text, numbers, images, scientific data and just about anything else you might save on a i computer.
(a) Both A and R are True, And R is the correct explanation for A.
(b) Both A and R are True, But R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.
Answer:
(a) Both A and R are True, And R is the correct explanation for A.

Question 12.
Assertion (A):
Modular programming is a software design technique to split your code into separate parts.
Reason (R):
Python has number of standard (Build-in) modules.
(a) Both A and R are True, And R is the correct explanation for A.
(b) Both A and R are True, But R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.
Answer:
(b) Both A and R are True, But R is not the correct explanation for A.

Question 13.
Pick the odd one out.
(a) TCI
(b) ASP
(c) Ruby
(d) Java
Answer:
(d) Java

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 14.
Which language is used both as scripting and general purpose language?
(a) C
(b) C++
(c) Python
(d) HTML
Answer:
(c) Python

Question 15.
Which programming language is designed for integrating and communicating with other programming language?
(a) Modular language
(b) Procedural language
(c) Scripting language
(d) High level language
Answer:
(a) Modular language

Question 16.
Which of the following is not a scripting language?
(a) Ruby
(b) TCI
(c) ASP
(d) COBOL
Answer:
(d) COBOL

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 17.
Which requires a programming language?
(a) Compiler
(b) Interpreter
(c) Editor
(d) Exefile
Answer:
(a) Compiler

Question 18.
Which is requires a scripting language?
(a) Compiler
(b) Interpreter
(c) Editor
(d) Exefile
Answer:
(b) Interpreter

Question 19.
Which of the following interface used for interfacing with C programs?
(a) Cython
(b) Ctypes
(c) MinGw
(d) SWIG
Answer:
(b) Ctypes

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 20.
Which of the following python interface used for both C and C++?
(a) Cython
(b) Ctypes
(c) MinGw
(d) SWIG
Answer:
(d) SWIG

Question 21.
Which is needed to run a C++ program on windows?
(a) m++
(b) g++
(c) e++
(d) f++
Answer:
(b) g++

Question 22.
Which of the following is not a python module?
(a) sys
(b) g++
(c) os
(d) Getopt
Answer:
(b) g++

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 23.
Which version of MinGw is the best compilerfor C++ on windows?
(a) W32
(b) W64
(c) W128
(d) W256
Answer:
(a) W32

Question 24.
Which interface to a set of runtime headerfiles, used compiling and linking the code of C, C++?
(a) SWIG
(b) MinGw
(c) Cython
(d) Ctypes
Answer:
(b) MinGw

Question 25.
g++ is a
(a) module
(b) program
(c) scope
(d) identifier
Answer:
(b) program

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 26.
Which command is used to clear the screen in window?
(a) els
(b) clear
(c) cs
(d) cl
Answer:
(a) els

Question 27.
Which operator is used to access the function?
(a) (.) dot
(b) (:) colon
(c) (,) comma
(d) (;) semi colon
Answer:
(a) (.) dot

Question 28.
Which is mostly used as a ‘glue’ language?
(a) C
(b) C++
(c) Java
(d) Python
Answer:
(d) Python

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 29.
Which of the following is not a scripting language?
(a) JavaScript
(b) PHP
(c) Perl
(d) HTML
Answer:
(d) HTML

Question 30.
Importing C++ program in a Python program is called:
(a) wrapping
(b) Downloading
(c) Interconnecting
(d) Parsing
Answer:
(a) wrapping

Question 31.
The expansion of API is:
(a) Application Programming Interpreter
(b) Application Programming Interface
(c) Application Performing Interface
(d) Application Programming Interlink
Answer:
(b) Application Programming Interface

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 32.
A framework for interfacing Python and C++ is:
(a) Ctypes
(b) SWIG
(c) Cython
(d) Boost
Answer:
(d) Boost

Question 33.
Which of the following is a software design technique to split your code into separate parts?
(a) Object oriented Programming
(b) Modular programming
(c) Low Level Programming
(d) Procedure oriented Programming
Answer:
(b) Modular programming

Question 34.
The module which allows you to interface with the Windows operating system is:
(a) OS module
(b) sys module
(c) csv module
(d) getopt module
Answer:
(a) OS module

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 35.
getopt( ) will return an empty array if there is no error in splitting strings to:
(a) argv variable
(b) opt variable
(c) args variable
(d) ifile variable
Answer:
(c) args variable

Question 36.
Identify the function call statement in the following snippet.
if _name _ ==‘_main_
main(sys.argv[l:])
(a) main(sys.argv[l:])
(b) _name_
(c) _main_
(d) argv
Answer:
(c) main

Question 37.
Which of the following can be used for processing text, numbers, images, and scientific data?
(a) HTML
(b) C
(c) C++
(d) PYTHON
Answer:
(d) PYTHON

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 14 Importing C++ Programs in Python

Question 38.
What does name contains ?
(a) C++ filename
(b) main( ) name
(c) python filename
(d) os module name
Answer:
(d) os module name

TN Board 12th Computer Science Important Questions