12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications மின்னணு தரவு பரிமாற்றம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிக பாதுகாப்பு அமைப்புகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின்னணு செலுத்தல் முறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications திறந்த மூல கருத்துருக்கள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு வடமிடல் Sample Question Papers Study Material - QB365 Set A

Published on: 03/12/2019
Importing C++ Programs in Python
Download Tamil Nadu 12th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
Which of the following is not a compiled statically typed language?
C++
Java
Python
All of these
2.
Which of the following is not general purpose language?
Python
Perl
Java
C++
3.
getopt() will return an empty array if there is no error in splitting strings to
argv variable
opt variable
args variable
ifile variable
4.
5.
Which of the following is not a scripting language?
JavaScript
PHP
Perl
HTML
6.
Write a note on main (sys.argv [1]).
7.
What is the use of GNU C complier?
8.
List some scripting language
9.
What is the use of modules?
10.
Write the expansion of (i) SWIG (ii) MinGW
11.
Write an algorithm for executing C++ program pali_cpp.cpp using python program.pall.py.
12.
List the commonly used python interfaces.
13.
What is sys.argv? What does it contain?
14.
What is MinGW? What is its use?
15.
What are the applications of scripting language?
16.
Write a python program to execute the following C++ program.
Transpose of a matrix(2 D array) 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 ("cIs");
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;
}
// Save this file as trans_cpp.cpp
17.
1.
(c)
Python
2.
(b)
Perl
3.
(a)
argv variable
4.
(a)
5.
(d)
HTML
6.
maintsv (sys.argv[1]) Accepts the program file (Python program) and the input file (C++file) as a list(array). argv[0] contains the Python program which is need not to be passed because by default _main_ contains source code reference and argv (1) contains the name of the C++ file which is to be processed.
7.
g++ is a program that calls GCC (GNU C Compiler) and automatically links the required C++library files to the object code
8.
The most widely used scripting languages are JavaScript, VBScript, PHP, Perl, Python, Ruby, ASP and Tcl.
9.
Modular programming is a software design technique to split our code into separate parts. These parts are called modules. The focus for this separation should have modules with no or just few dependencies upon other modules.
10.
(i) SWIG - Simplified Wrapper Interface Generator
(ii) MinGW - Minimalist GNU for Windows
11.
Step 1: Type the C++ program to check whether the input number is palindrome or not in notepad and save it as "pali_cpp.cpp".
Step 2: Type the Python program and save it as pali.py.
Step 3: Click the Run Terminal and open the command window
Step 4: Go to the folder of Python using cd command
Step 5: Type the command Python pali.py -i pali_cpp
12.
The commonly used interfaces are
(i) Python-C-API (API-Application Programming Interface for interfacing with C programs)
(ii) Ctypes (for interfacing with c programs)
(iii) SWIG (Simplified Wrapper Interface Generator- Both C and C++)
(iv) Cython (Cython is both a Python-like language for writing C-extensions)
(v) Boost. Python (a framework for interfacing Python and c++)
(vi) MinGW (Minimalist GNU for Windows)
13.
sys.argv is the list of command-line arguments passed to the Python program. 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.
To use syss.argv, we will first have to import sys. 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 we pass to the program.
Example:
main (sys.argv [1]) - Accepts the program file and the input file as a list. argv[0] contains the python program which is need not to be passed because by default _main_contains source code reference and argv[1] contains the name of the C++ file which is to be processed.
14.
(i) MinGW 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.
(ii) MinGw- W64 (version of MinGW) is the best compiler for C++ on Windows. To compile and execute the C++ program, need 'g++' for Windows. MinGW allows to compile and execute C++ program dynamically through Python program using g++.
(iii) Python program that contains the c++ coding can be executed only through 'MinGW_w64 project' run terminal. The run terminal open the command -line window through which Python program should be executed.
(iv) g++ is a program that calls GCC (GNU C compiler) and automatically links the required C++ Library files to the object code.
15.
(i) To automate certain tasks in a program
(ii) Extracting information from a data set
(iii) Less code intensive as compared to traditional programming language
(iv) can bring new functions to applications and glue complex systems together
(v) Conjuction with other programming languages HTML, Java, C++.
16.
//Now select File⟶New in Notepad and type the Python program
# Save the File as transpose.py. Program that compiles and executes a .cpp file
# Python tanspose.py -i trans_cpp
Python 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, exe_file)
defrun( 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:])
17.
12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications களப்பெயர் முறைமை (DNS) Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு எடுத்துக்காட்டுகள் மற்றும் நெறிமுறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications கணினி வலையமைப்பு ஓர் அறிமுகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications PHP-உடன் MySQL-ஐ இணைத்தல் Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 12th Standard Subjects

Maths

Chemistry

Physics

Biology

Computer Science

Business Maths and Statistics

Economics

Commerce

Accountancy

History

Computer Applications

Biology

Computer Technology

Computer Applications

Computer Science

Business Maths and Statistics

Commerce

Economics

Maths

Chemistry

Physics

Computer Technology

History

Accountancy

Tamil

English

French
Tamilnadu Stateboard Standards