New ! Computer Science MCQ Practise Tests



Importing C++ Programs in Python 5 Mark Creative Question Paper With Answer Key

12th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Science

Time : 02:30:00 Hrs
Total Marks : 75

     5 Marks

    15 x 5 = 75
  1. Explain the commands for wrapping C++ code.

  2. Write a python program to execute the following C++ program.
    /*. To check whether the number is palindrome or not using while Ioop.*/
    // Now select File →New in Notepad and type the C++ program
    #include < iostream >
    using namespace std;
    intmain ( )
    {
    int n, num, digit, rev = 0;
    cout<<  "Enter a positive number: ";
    cin >>num;
    n= num;
    while(num)
    {digit = num % 10;
    rev = (rev * 10) + digit;
    num = num / 10; }
    cout<< "The reverse of the number is: " << rev <<endl;
    if(n == rev)
    cout< < "The number is a palindrome";
    else
    cout << "The number is not a palindrome";
    return 0;
    }
    // Save this file as pali_cpp.cpp

  3. 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

  4. Write a python program to execute the following C++ program.
    C++ program:
    /*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
    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 cube_file.cpp

  5. Write a python program to execute the following C++ program
    To implement Multilevel Inheritance:
    // C++ program to implement Multilevel Inheritance
    // Now select File ⟶New in Notepad and type the C++ program
    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 vehicles" << 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

  6. Explain the steps involved in executing the C; program through python?

  7. Write the steps involved in executing C++ prog through Python.

  8. Explain how importing modules in Python was done?

  9. Explain modular Programming in Python with an example.

  10. Explain in detail about Python sys module.

  11. Explain in detail about python's os module.

  12. Explain in detail about Python getotp mode.

  13. Explain detail about wrapping C++ code using if name.

  14. Explain in detail about importing of C++ program in Python? Give an example.

  15. Explain in detail about how Python is handle the errors in C++?

*****************************************

Reviews & Comments about 12th Standard Computer Science English Medium - Importing C++ Programs in Python 5 Mark Creative Question Paper and Answer Key 2022 - 2023

Write your Comment