TCS Papers: Sample Questions 482 - 483 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 482

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What are the advantages and disadvantages of a heap?


  • Advantages:

  • Storing data on the heap is slower than stack but main advantage is flexibility.

  • Memory can be allocated and removed in any particular order.

  • Garbage Collection runs on the heap memory to free the memory used by objects that don’t have any reference.

  • Any object in the heap space has global access and can be referenced from anywhere of the application.

  • Memory on stack can be accessed only by the called function

  • Disadvantages:

  • Heap is slower than stack.

  • Slowness in the heap can be compensated if an algorithm is well designed and implemented.

  • Memory management is more complex in heap because it is used globally.

  • Heap memory is divided into Young-Generation, Old-Generation etc.

Question number: 483

» Basic CS » Operating System

Essay Question▾

Describe in Detail

What is thrashing?


  • It is a phenomenon in virtual memory schemes when the processor spends most of its time swapping pages, rather than executing instructions, due to an inordinate number of page faults.

  • Thrashing in computing is an issue caused when virtual memory is in use.

  • It occurs when the virtual memory of a computer is rapidly exchanging data for data on hard disk, to the exclusion of most application-level processing.

  • As the main memory gets filled, additional pages need to be swapped in and out of virtual memory.

  • The swapping causes a very high rate of hard disk access.

  • Thrashing can continue for a long duration until the underlying issue is addressed.

  • Thrashing can potentially result in total collapse of the hard drive of the computer.

  • Thrashing is also known as disk thrashing.

Image of The Thrashing

Image of the Thrashing

Given the image is define the Trashing.