Question

In: Computer Science

[Computer Science Question] Compare and Contrast the trade-offs associated with using C++ in comparison to Python....

[Computer Science Question]

Compare and Contrast the trade-offs associated with using C++ in comparison to Python. How do the characteristics of the languages impact the amount of memory each language occupies. How do memory considerations impact each languages real world implementations?

Solutions

Expert Solution

Both python and c++ are programming languages, mostly used for same purpose, but they both have different characteristics, and they both differ in many ways.

C++:

Actually c++ is not platform independent , hence for each and every operating system the program needs to be compiled once.

Python:

Python has the ability of "write once and comiple anywhere" hence the python progtams are platform independent, which is a great advantage over c++

C++:

It is little hard for users, users need to memorize many syntax and datatype, for example: before using a variable we must declare the type of data(int,float,char,double etc.,).

Python:

Here, there is no need of such datatypes, the compiler itself will recognize the datatype, which makes the code look easier.

C++:

It is a mix of procedural and object oriented laguage.here rapid prototyping is not possible.

Python:

It is known for its simplicity.Here rapid prototyping is possible.

When it comes to memory:

C++ has a bad memory management when compared to the advanced languages like python, this is because c++ does not provide the facility of automatic garbage collection, hence every object created will not be destroyed, which leads to accumulation of unwanted memory. Whereas in python garbage collection is available, the objects are automatically destroyed if the objects are not required.

And the main difference is that c++ make use of pointers very often, this is a main drawback since access to pointer can lead to memory access, hence the memory can be manipulated very easily. In order to avoid this issue pointer are eliminated in python.

In real world application, the process of execution should have a very low space complexity(amount of memory required to run the program should be low). An effecient application should take less space, and mainly it should not access the memory locations. Hence memory considerations are very high when it comes to an effective program. Hence to do this we require a language that uses less memory and a language that is more secure. While comparing c++ and python, python is more useful for the real world implementation.


Related Solutions

What are the political, economic, and social trade-offs associated with tourism?
What are the political, economic, and social trade-offs associated with tourism?
home / study / engineering / computer science / computer science questions and answers / Using...
home / study / engineering / computer science / computer science questions and answers / Using JAVA The Following Code Is Able To Read Integers From A File That Is Called "start.ppm" ... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: Using JAVA The following code is able to read integers from a file that is called "start.ppm" ont... Using JAVA The following code is able to read integers from...
air travel can be made safer by increasing the security efforts. Identify the trade-offs associated with...
air travel can be made safer by increasing the security efforts. Identify the trade-offs associated with increasing security checks of individual passengers and their luggage. be sure to consider the effect on ghe demand for air travel and the resulting effects on automobile travel that statistically has a greater risk of injury and death per mile than air travel.
1. Compare and contrast the "idealized" political science view of the state with that of the...
1. Compare and contrast the "idealized" political science view of the state with that of the public choice economist. 2. What is wrong with the democracy in the efficient provision of public goods? 3. Why does the assumption of rational utility maximization lead to failure in the public sector? Why doesn't this happen in the private sector?
PYTHON PROGRAM QUESTION 1 Briefly describe how a while loop works QUESTION 2 Compare and contrast  a...
PYTHON PROGRAM QUESTION 1 Briefly describe how a while loop works QUESTION 2 Compare and contrast  a while statement and an  if statement ? QUESTION 3 What is a loop body? QUESTION 4 What is the value of variable num after the following code segment? num = 10; while  num > 0:   num = num -1; QUESTION 5 What is the value of variable num after the following code segment is executed? var num = 1 while  num >10:   num = num -1 QUESTION...
Python Question: Johnny has some difficulty memorizing the small prime numbers. So, his computer science teacher...
Python Question: Johnny has some difficulty memorizing the small prime numbers. So, his computer science teacher has asked him to play with the following puzzle game frequently. The puzzle is a 3x3 board consisting of numbers from 1 to 9. The objective of the puzzle is to swap the tiles until the following final state is reached: 1 2 3 4 5 6 7 8 9 At each step, Johnny may swap two adjacent tiles if their sum is a...
Question 1 Describe some of the trade-offs faced by each of the following: a. a family...
Question 1 Describe some of the trade-offs faced by each of the following: a. a family deciding whether to buy a new car b. a member of Congress deciding how much to spend on national parks c. a company president deciding whether to open a new factory d. a professor deciding how much to prepare for class e. a recent college graduate deciding whether to go to graduate school Question 2 i. The company that you manage has invested $5...
(Political Science) Compare and contrast presidential, cabinet, and hybrid systems of government.
(Political Science) Compare and contrast presidential, cabinet, and hybrid systems of government.
Write a comparison essay in which you compare and contrast standards of beauty for women and...
Write a comparison essay in which you compare and contrast standards of beauty for women and men within your peer group. Be sure to consider how strictly the standards are applied in each case.
home / study / engineering / computer science / questions and answers / this is c....
home / study / engineering / computer science / questions and answers / this is c. create three files to submit. contacts.h ... Question: This is C. Create three files to submit. Contacts.... Bookmark This is C. Create three files to submit. Contacts.h - Struct definition, including the data members and related function declarations Contacts.c - Related function definitions main.c - main() function (2) Build the ContactNode struct per the following specifications: Data members char contactName[50] char contactPhoneNum[50] struct ContactNode*...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT