TCS Papers: Sample Questions 232 - 233 of 502

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

Question number: 232

» Basic CS » Networks

Essay Question▾

Describe in Detail

What is garbage collection? Explain the difference between garbage collection in. NET 4.0 and earlier versions.


  • Garbage collection prevents memory leaks during execution of programs.

  • Garbage collector is a low-priority process that manages the allocation and deallocation of memory for application.

  • Checks unreferenced variables and objects.

  • GC finds objects no longer used by the application and frees up the memory from that object. In. NET 4.0, the GC. Collect () method contains the following overloaded methods:

    • GC. Collect (int)

    • GC. Collect (int, GCCollectionMode)

  • . NET also notifies when the GC. Collect () method is invoked and completed successfully.

  • . NET 4.0 supports new background garbage collection replacing the concurrent garbage collection used in earlier versions.

  • Concurrent GC allocates memory while running and uses current segment (which is 16 MB on a workstation) for that. After that, all threads are suspended. In case of background GC, a separate ephemeral GC – gen0 and gen1 can be started, while the full GC – gen0,1, and 2 – is already running.

Question number: 233

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What does the format % 10.2 mean when included in a printf statement?


  • This format is used for two things:

    • Set the number of spaces allotted for the output number

    • Set the number of decimal places

  • The number before the decimal point is for the allotted space, in this case it would allot 10 spaces for the output number.

  • If the number of space occupied by the output number is less than 10, addition space characters will be inserted before the actual output number.

  • The number after the decimal point sets the number of decimal places, in this case, its 2 decimal spaces.

Format of printf statement in image

Format of Printf Statement in Image

Given the image is define the format % 10.2 mean when included in a printf statement