TCS Papers: Sample Questions 377 - 378 of 502

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

Question number: 377

» Basic CS » Networks

Short Answer Question▾

Write in Short

What is Bit stuffing?

Explanation

Bit stuffing adds one extra 0 whenever five consecutive 1’s follow a 0 in the data, so that the receiver does not mistake the pattern 0111110 for a flag- each frame begins and ends with a special bit pattern called a flag byte [01111110].

Image shows the Bit stuff

Image Shows the Bit Stuff

Given the image is defining the bit stuffing.

Question number: 378

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is the difference between calloc () and malloc ()?

Explanation

  • calloc (…) allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size).

  • malloc (…) takes in only a single argument which is the memory required in bytes. malloc (…) allocated bytes of memory and not blocks of memory like calloc (…).

  • malloc (…) allocates memory blocks and returns a void pointer to the allocated space, or NULL if there is insufficient memory.

  • calloc (…) allocates an array in memory with elements initialized to 0 and returns a pointer to the allocated space. calloc (…) calls malloc (…) in order to use the C++ _set_new_mode function to set the new handler mode.

Difference between calloc() and malloc()

Difference between Calloc () and Malloc ()

Given the image is define the difference between calloc () and malloc ()