TCS Papers: Sample Questions 392 - 393 of 502

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

Question number: 392

» Basic CS » Networks

Short Answer Question▾

Write in Short

What is fixed size framing?

Explanation

  • Frames are used as they increase reliability- a message packed in one frame would require retransmission of the whole message even on a single-bit error.

  • Frames can be of fixed or variable size. In fixed-size framing, there is no need for delimiter at boundaries.

  • Ex: ATM wide-area network uses frames of fixed size called cells.

Question number: 393

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

Given the bitwise operators in c

Explanation

  • In C, following 6 operators are bitwise

  • & (bitwise AND): Takes two numbers as operands and does AND on every bit of two numbers. The result of AND is 1 only if both bits are 1.

  • | (bitwise OR): Takes two numbers as operands and does OR on every bit of two numbers. The result of OR is 1 any of the two bits is 1.

  • ^ (bitwise XOR): Takes two numbers as operands and does XOR on every bit of two numbers. The result of XOR is 1 if the two bits are different.

  • < < (left shift): Takes two numbers, left shifts the bits of the first operand determined by the second operand.

  • > > (right shift): Takes two numbers, right shifts the bits of the first operand as defined by second operand.

  • ~ (bitwise NOT): Takes one number and inverts all its bits

  • Example:

  1. #include<stdio.h>
  2. int main()
  3. {
  4.     unsigned char x = 7y = 12;
  5.     printf("x = %d, y = %d "xy);
  6.     printf("x&y = %d "x&y);
  7.     printf("x|y = %d "x|y);
  8.     printf("x^y = %d "x^y);
  9.     printf("~x = %d "x = ~x);
  10.     printf("y<<1 = %d "y<<1);
  11.     printf("y>>1 = %d "y>>1);
  12.     return 0;
  13. }
  • Output:

x = 7, y = 12

x&y = 4

x|y = 15

x^y = 11

~x = 248

Y < < 1 = 24

y > > 1 = 6