# Redpine Infotech Papers: Sample Questions 8 - 9 of 19

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

## Question number: 8

MCQ▾

### Question

What is output for the following program?

1. `#include<stdio.h>`
2. `main ()`
3. `{`
4. `    int a= 10, b=5;`
5. `    if(a=a&b)b=ab;`
6. `    printf (“a=%d, b=%d” a, b);`
7. `}`

### Choices

Choice (4) Response

a.

a = 0, b = 0

b.

a = 10, b = 5

c.

a = 0, b = 5

d.

All of the above

c.

### Explanation

 #include < tdio. h > Standard library function main () Startup after initialization int a = 10, b = 5; Declare integer values a = 10 and b = 5 if (a = a&b) b=; In if condition (a = a&b) b=, when given a = 10 (00001010), b = 5 (00000101) (a = a&b) = 00000000. This is also false thus a = 0 and b = 5 (already given) printf (“a=%d, b=%d” a, b); Print a = 0 and b = 5

## Question number: 9

Essay Question▾

### Describe in Detail

What is the mechanism used for error detection in Data Link Layer?

### Explanation

• Error in the received frames is detected by Parity check and CRC (cyclic redundancy).

## Parity check:

• One extra bit is sent with the original bits to make number of 1s either even, in case of even parity or odd, in case of odd parity.

• The sender while creating a frame counts the number of 1s in it.

• For example, if even parity is used and number of 1s is even then one bit with value 0 is added.

• This way numbers of 1s remain even.

• The number of 1s is odd; to make it even a bit with value 1 is added. The Number of 1s is Odd The number of 1s is odd
• The receiver simply counts the number of 1s in a frame.

• If the count of 1s is even and even parity is used the frame is considered to be not-corrupted and is accepted.

• If the count of 1s is odd and odd parity is used, the frame is still not corrupted.

## CRC:

• CRC is based on binary division.

• A sequence of redundant bits called cyclic redundancy check bits are the end of data unit so the resulting data unit becomes exactly divisible by a second binary number.

• The destination, the incoming data unit is divided by the same number.

• If at this step there is no remainder, the data unit is assumed to be correct and is therefore accepted.

• A remainder indicates that the data unit has been damaged in transit and therefore must be rejected.

For example,