Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Ask The Science

Ask The Science Logo Ask The Science Logo

Ask The Science Navigation

  • Home
  • Blog
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
  • Home
  • Blog
  • About Us
  • Contact Us
Home/ Questions/Q 474
Next
In Process

Ask The Science Latest Questions

developerwithlove
  • 3
  • 3
developerwithlove
Asked: October 20, 20222022-10-20T23:58:30+05:30 2022-10-20T23:58:30+05:30

What is the difference between deep copy and shallow copy?

  • 3
  • 3

What is the difference between deep copy and shallow copy?

pythonpython interview questions
  • 1 1 Answer
  • 88 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    1 Answer

    • Voted
    • Oldest
    • Recent
    1. Ask The Science
      Ask The Science
      2022-10-21T00:01:38+05:30Added an answer on October 21, 2022 at 12:01 am

      We use a shallow copy when a new instance type gets created. It keeps the values that are copied in the new instance. Just like it copies the values, the shallow copy also copies the reference pointers.

      Reference points copied in the shallow copy reference to the original objects. Any changes made in any member of the class affect the original copy of the same. Shallow copy enables faster execution of the program.

      Deep copy is used for storing values that are already copied. Unlike shallow copy, it doesn’t copy the reference pointers to the objects. Deep copy makes the reference to an object in addition to storing the new object that is pointed by some other object.

      Changes made to the original copy will not affect any other copy that makes use of the referenced or stored object. Contrary to the shallow copy, deep copy makes the execution of a program slower. This is due to the fact that it makes some copies for each object that is called.

        • 1
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Ask A Question

    Related Questions

    • How do you distinguish between NumPy and SciPy?

    • Draw a comparison between the range and xrange in Python.

    • Describe multithreading in Python.

    • Differentiate between list and tuple.

    • What are Python decorators?

    • Popular
    • Answers
    • Ask The Science

      Why Should We Hire You?

      • 2 Answers
    • BigB

      Why do we not fall off from the Earth?

      • 2 Answers
    • BigB

      What is the internal structure of the Earth?

      • 1 Answer
    • BigB

      How do we discover what is inside the Earth?

      • 1 Answer
    • BigB

      How did we discover that the Earth is round?

      • 1 Answer
    • developerwithlove
      developerwithlove added an answer The following are the most significant advantages of the Agile… October 3, 2023 at 11:25 am
    • developerwithlove
      developerwithlove added an answer The following are some widely accepted principles of Agile testing:… October 3, 2023 at 11:23 am
    • developerwithlove
      developerwithlove added an answer Agile testing is a critical step in the process. It… October 3, 2023 at 11:22 am
    • developerwithlove
      developerwithlove added an answer Agile is an iterative and incremental approach to project management… October 3, 2023 at 11:22 am
    • Ask The Science
      Ask The Science added an answer Scrum and Agile are often used interchangeably, but the two aren’t… October 3, 2023 at 11:11 am

    Trending Tags

    agile interview questions cyber security interview questions data engineer interview questions data structure data structure interview questions data structure interview questions and answers data structures front end front end interview questions general interview questions interview questions linked list python python interview questions qa interview questions queue queue data structure scrum master interview questions social media interview questions software testing interview questions sql interview questions

    Explore

    • Recent Questions
    • Most Answered
    • Answers
    • No Answers
    • Most Visited
    • Most Voted
    • Random

    Footer

    Ask the Science

    Ask the Science is a Science questions & Answers Engine which will help you establish your community and connect with other people.

    Legal

    • Privacy Policy
    • Terms and Conditions

    About Us

    • About Us
    • Blog
    • Contact Us

    © 2022, All Rights Reserved
    With Love by Ask The Science.