TN Online TestSamacheer Kalvi practice

12th Standard Computer Science — Importing C++ programs in Python.: Additional MCQs with Answers & Explanations

Share this chapter: Telegram

15 extra multiple-choice questions for Importing C++ programs in Python. (12th Standard Computer Science, Samacheer Kalvi), beyond the ones printed in the textbook — each with the correct option highlighted and a clear, worked explanation. Free to read in English and Tamil.

Answer key at a glance

Q1
Which of the following is a characteristic feature of C++ compared to Python?
  • A. It is dynamically typed
  • B. It is statically typedCorrect
  • C. It does not require explicit variable declaration
  • D. It is typically an interpreted language
Explanation. C++ is a compiled, statically typed language which requires variables to be explicitly declared with their data types before use, unlike Python which is dynamically typed.
Q2
A programming language designed for integrating and communicating with other programming languages is known as a:
  • A. Scripting languageCorrect
  • B. Machine language
  • C. Assembly language
  • D. Low-level language
Explanation. A scripting language is design-optimized for integrating and connecting different programs and components written in other programming languages.
Q3
What is the process by which Python periodically frees and reclaims blocks of memory that are no longer in use?
  • A. Memory allocation
  • B. Dynamic binding
  • C. Garbage CollectionCorrect
  • D. Static linking
Explanation. Garbage collection is Python's automatic memory management process that periodically frees up memory space occupied by unwanted or unused objects.
Q4
What does SWIG stand for in the context of C++ integration with Python?
  • A. Software Wrapper and Integration Generator
  • B. Static Web Interface Guide
  • C. System Wrapper Interface Gateway
  • D. Simplified Wrapper Interface GeneratorCorrect
Explanation. SWIG is an abbreviation for Simplified Wrapper Interface Generator, a tool used to connect programs written in C/C++ with scripting languages like Python.
Q5
Which runtime compiler suite allows compiling and linking C++ code dynamically through Python on the Windows Operating System?
  • A. Cython
  • B. MinGWCorrect
  • C. Pygame
  • D. IDLE
Explanation. MinGW (Minimalist GNU for Windows) provides runtime headers and tools, including the g++ compiler, to compile and execute C++ programs on Windows.
Q6
What does the first element of sys.argv, sys.argv, contain when running a Python script from the command line?
  • A. The name of the input C++ file
  • B. The name of the Python programCorrect
  • C. The first command-line option
  • D. The operating system name
Explanation. In Python, sys.argv always holds the name of the script being executed, while the subsequent elements hold any passed command-line arguments.
Q7
In contrast to Python, how many values can a C++ return statement return directly to its caller?
  • A. Only one valueCorrect
  • B. Multiple values as a tuple
  • C. Up to five values
  • D. Any number of values
Explanation. C++ functions can return only a single value directly using the return statement, whereas Python functions can easily return multiple values separated by commas.
Q8
In the command os.system('g++ ' + inp_file + ' -o ' + exe_file), what does the option '-o' specify?
  • A. Input mode
  • B. Optimization level
  • C. Output file nameCorrect
  • D. Operating system type
Explanation. The -o flag in the g++ compiler command specifies that the subsequent string is the name of the output executable file to be generated.
Q9
The getopt.getopt() method returns a value consisting of how many elements?
  • A. One element
  • B. Two elementsCorrect
  • C. Three elements
  • D. Four elements
Explanation. The getopt.getopt() method parses command-line arguments and returns two elements: a list of option-value pairs (opts) and a list of leftover arguments (args).
Q10
If a Python source file is executed directly as the main program, what value is assigned to the special variable __name__ by the interpreter?
  • A. "__main__"Correct
  • B. "__name__"
  • C. "sys.argv"
  • D. "os.system"
Explanation. When a Python script is run as the main program, the interpreter sets the special built-in variable __name__ to the string "__main__".
Q11
In Python, which slicing expression on sys.argv is commonly used to pass all command-line arguments except the script's own file name?
  • A. sys.argv[0:]
  • B. sys.argv[1:]Correct
  • C. sys.argv[:1]
  • D. sys.argv[-1:]
Explanation. Slicing sys.argv with 1: skips the first element (the program name at index 0) and returns all subsequent arguments passed in the command line.
Q12
The program g++ automatically compiles and links C++ source files by invoking which of the following?
  • A. GCC (GNU C Compiler)Correct
  • B. SWIG
  • C. Python Interpreter
  • D. Boost.Python
Explanation. g++ is a command that calls GCC (GNU Compiler Collection) and automatically links C++ library files to generate object code.
Q13
In the getopt.getopt(argv, "i:") function call, what does the colon ":" after the option letter 'i' indicate?
  • A. The option is optional
  • B. The option requires an argumentCorrect
  • C. The option is case-insensitive
  • D. The option marks the end of the argument list
Explanation. In the getopt module, a colon following an option letter indicates that this option requires a corresponding argument value.
Q14
What is the main theoretical difference between scripting languages and traditional programming languages?
  • A. Scripting languages always require a separate compilation step
  • B. Scripting languages do not require a separate compilation step and are interpretedCorrect
  • C. Scripting languages cannot use variables
  • D. Scripting languages are statically typed
Explanation. Unlike traditional programming languages that must be compiled into machine code before execution, scripting languages are interpreted directly without a compilation step.
Q15
Which operator is used to access functions defined inside an imported Python module?
  • A. Colon operator (":")
  • B. Scope resolution operator ("::")
  • C. Dot operator (".")Correct
  • D. Arrow operator ("->")
Explanation. The dot (".") operator is used in Python to reference and access attributes or functions contained within a specified imported module.
Take the Additional practice test → Open the app

More for this chapter

Book Back Questions10 textbook MCQs · solved Practice TestInteractive · instant score Book Back TestTest yourself on the textbook set Additional MCQ TestTest yourself on the extra set Study NotesConcepts & methods Formula SheetAll key formulas

About these Importing C++ programs in Python. questions

These are the Additional multiple-choice questions for Importing C++ programs in Python. from the Tamil Nadu State Board (Samacheer Kalvi) 12th Standard Computer Science syllabus. Each question shows the correct option and an original, step-by-step explanation so you understand the method, not just the answer. Use the answer key above to jump to any question, then take the practice test to check yourself under exam-like conditions.

Frequently asked questions

How many MCQs are there in Importing C++ programs in Python.?

This chapter has 15 book-back multiple-choice questions, each with the correct answer and a step-by-step explanation.

Are these 12th Standard Computer Science MCQs free to practise online?

Yes. Every question, answer and explanation here is free, and you can also take them as a timed practice test.

Where can I find the Importing C++ programs in Python. book-back answers?

The correct option for each question is highlighted on this page with a worked explanation, plus a quick answer-key summary at the top.

More chapters in Computer Science

View all
1 Function 2 Data Abstraction 3 Scoping 4 Algorithmic Strategies 5 Python -Variables and Operators 6 Control Structures 7 Python functions 8 Strings and String manipulation 9 Lists, Tuples, Sets and Dictionary 10 Python Classes and objects 11 Database Concepts 12 Structured Query Language (SQL) 13 Python and CSV files 15 Data manipulation through SQL 16 Data visualization using pyplot: line chart, pie chart and bar chart